1625N/A<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2887N/A<!DOCTYPE stax SYSTEM "/shared/stax.dtd">
1625N/A<!--
1625N/A ! CDDL HEADER START
1625N/A !
1625N/A ! The contents of this file are subject to the terms of the
1625N/A ! Common Development and Distribution License, Version 1.0 only
1625N/A ! (the "License"). You may not use this file except in compliance
1625N/A ! with the License.
1625N/A !
1625N/A ! You can obtain a copy of the license at
1625N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
1625N/A ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
1625N/A ! See the License for the specific language governing permissions
1625N/A ! and limitations under the License.
1625N/A !
1625N/A ! When distributing Covered Code, include this CDDL HEADER in each
1625N/A ! file and include the License file at
1625N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
1625N/A ! add the following below this CDDL HEADER, with the fields enclosed
1625N/A ! by brackets "[]" replaced with your own identifying information:
1625N/A ! Portions Copyright [yyyy] [name of copyright owner]
1625N/A !
1625N/A ! CDDL HEADER END
1625N/A !
5064N/A ! Copyright 2007-2010 Sun Microsystems, Inc.
6184N/A ! Portions Copyright 2013 ForgeRock AS
1625N/A ! -->
1625N/A<stax>
3660N/A <defaultcall function="main_indexes" />
3660N/A <function name="main_indexes">
3816N/A <function-list-args>
3816N/A <function-required-arg name="STAXParentID"/>
3816N/A </function-list-args>
1914N/A <block name="'indexes'">
1914N/A <sequence>
3816N/A <!--- Load the job environment for the test group execution -->
3816N/A <import machine="STAF_LOCAL_HOSTNAME"
3816N/A file="'%s/environment.xml' % TESTS_FUNCTIONS_DIR" />
3816N/A <call function="'loadJobEnvironment'">
3816N/A { 'parent' : STAXParentID }
3816N/A </call>
1914N/A <script>
3853N/A CurrentTestPath['group'] = 'indexes'
1914N/A envAlreadyLoaded='true'
5098N/A _testSteps=['indexes_setup','indexes_search','indexes_modify',
5098N/A 'indexes_dynamic_modify','indexes_add',
5098N/A 'indexes_dynamic_add','indexes_remove',
5098N/A 'indexes_entry_limit','indexes_vlv_add','indexes_cleanup']
1914N/A </script>
1914N/A <!---
1914N/A #@TestSuiteName Indexes
1914N/A #@TestSuitePurpose test the database index feature from ldap
1914N/A #@TestSuiteGroup indexes
1914N/A #@TestScript indexes.xml
1914N/A -->
1914N/A
1914N/A <try>
1976N/A <!-- the pre-requisites are in a separate iteration -->
1914N/A <sequence>
3853N/A <call function="'testGroup_Preamble'"/>
1914N/A <iterate in="_testSteps" var="_testStep" indexvar="_testStepNumber">
3853N/A <call function="_testStep"/>
1914N/A </iterate>
1914N/A </sequence>
1914N/A <catch exception="'STAXException.Topology.CreationException'">
3142N/A <message log="1" level="'fatal'">
3142N/A 'Could not create the topology. Bailing out.'
3142N/A </message>
1914N/A </catch>
1914N/A <catch exception="'STAXException.Topology.StartException'">
3142N/A <message log="1" level="'fatal'">
3142N/A 'Could not start at least one server in the topology.Bailing out.'
3142N/A </message>
1914N/A </catch>
1914N/A <finally>
3853N/A <call function="'testGroup_Postamble'"/>
1914N/A </finally>
1914N/A </try>
1914N/A </sequence>
1914N/A </block>
1625N/A </function>
1625N/A
1914N/A <function name="indexes_search" scope="local">
1914N/A <!---
1914N/A This set of tests loop through a set of search filters to verify that
1914N/A the default indexes behave as expected
1914N/A #@TestMarker indexes
1914N/A #@TestName indexes_search
1914N/A #@TestIssue TODO: look up the issue in issue tracker
1914N/A #@TestPurpose harden the default indexes
1914N/A #@TestPreamble none
1914N/A #@TestStep iterate through file search.filters
1914N/A #@TestPostamble none
1914N/A #@TestResult Success if entry are indexed correctly
1914N/A -->
3853N/A <block name="'indexes_search'">
1914N/A <sequence>
3853N/A <script>
3853N/A CurrentTestPath['suite'] = STAXCurrentBlock
3853N/A </script>
3853N/A <call function="'testSuite_Preamble'"/>
3853N/A
1914N/A <message log="1" level="'info'">
1914N/A 'starting the search tests'
1914N/A </message>
1914N/A <call function="'loopThroughFilters'">
1914N/A { 'filters' : 'search' }
1914N/A </call>
3853N/A
3853N/A <call function="'testSuite_Postamble'"/>
1914N/A </sequence>
1914N/A </block>
1914N/A </function>
1914N/A
1914N/A
1914N/A <function name="indexes_modify" scope="local">
1914N/A <!--
1914N/A This test alters the uid default index so that it does subString search
1914N/A and then verifies that it worked
1914N/A #@TestMarker indexes
1914N/A #@TestName indexes_search
1914N/A #@TestIssue TODO: look up the issue in issue tracker
1914N/A #@TestPurpose harden the default indexes
1914N/A #@TestPreamble none
1914N/A #@TestStep iterate through file search.filters
1914N/A #@TestPostamble none
1914N/A #@TestResult Success if entry are indexed correctly
1914N/A -->
3853N/A <block name="'indexes_modify'">
1914N/A <sequence>
3853N/A <script>
3853N/A CurrentTestPath['suite'] = STAXCurrentBlock
3853N/A </script>
3853N/A <call function="'testSuite_Preamble'"/>
3853N/A
1914N/A <try>
1914N/A <sequence>
1914N/A <call function="'loopThroughFilters'">
1914N/A { 'filters' : 'before-modify' }
1914N/A </call>
5064N/A
5064N/A <testcase name="getTestCaseName('Modify and rebuild uid index')">
5064N/A <sequence>
5064N/A <call function="'testCase_Preamble'"/>
5064N/A
5064N/A <call function="'runFunction'">
5064N/A { 'functionName' : 'modifyIndex',
5064N/A 'functionMessage' : 'Adding substring index to attribute uid',
5064N/A 'functionArguments' : { 'operation' : 'add',
5064N/A 'indexAttribute' : 'uid',
5064N/A 'indexProperty' : 'index-type',
5064N/A 'indexPropertyValue' : 'substring'
5064N/A }
5064N/A }
5064N/A </call>
5064N/A <call function="'runFunction'">
5064N/A { 'functionName' : 'StopDsWithScript',
5064N/A 'functionArguments' : { 'location' : STAF_REMOTE_HOSTNAME,
5064N/A 'dsHost' : DIRECTORY_INSTANCE_HOST,
5064N/A 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
5064N/A 'dsBindDN' : DIRECTORY_INSTANCE_DN ,
5064N/A 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
5064N/A }
5064N/A </call>
5064N/A <call function="'runFunction'">
5064N/A { 'functionName' : 'rebuildIndexWithScript' ,
5064N/A 'functionArguments' : { 'dsBaseDN' : DIRECTORY_INSTANCE_SFX ,
6184N/A 'dsIndexList' : [ 'uid' ]
5064N/A }
5064N/A }
5064N/A </call>
5064N/A
5064N/A <call function="'runFunction'">
5064N/A { 'functionName' : 'StartDsWithScript',
5064N/A 'functionArguments' : { 'location' : STAF_REMOTE_HOSTNAME }
5064N/A }
5064N/A </call>
5064N/A <!--- Check that DS started -->
5064N/A <call function="'isAlive'">
5064N/A {
5064N/A 'noOfLoops' : 10 ,
5064N/A 'noOfMilliSeconds' : 2000
5064N/A }
5064N/A </call>
5064N/A
5064N/A <call function="'testCase_Postamble'"/>
5064N/A </sequence>
5064N/A </testcase>
5064N/A
1914N/A <call function="'loopThroughFilters'">
5064N/A { 'filters' : 'after-modify' }
1914N/A </call>
5098N/A
5098N/A <testcase name="getTestCaseName('Restore and rebuild uid index')">
5098N/A <sequence>
5098N/A <call function="'testCase_Preamble'"/>
5098N/A
5098N/A <call function="'runFunction'">
5098N/A { 'functionName' : 'modifyIndex',
5098N/A 'functionMessage' : 'Adding substring index to attribute uid',
5098N/A 'functionArguments' : { 'operation' : 'remove',
5098N/A 'indexAttribute' : 'uid',
5098N/A 'indexProperty' : 'index-type',
5098N/A 'indexPropertyValue' : 'substring'
5098N/A }
5098N/A }
5098N/A </call>
5098N/A <call function="'runFunction'">
5098N/A { 'functionName' : 'StopDsWithScript',
5098N/A 'functionArguments' : { 'location' : STAF_REMOTE_HOSTNAME,
5098N/A 'dsHost' : DIRECTORY_INSTANCE_HOST,
5098N/A 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
5098N/A 'dsBindDN' : DIRECTORY_INSTANCE_DN ,
5098N/A 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
5098N/A }
5098N/A </call>
5098N/A <call function="'runFunction'">
5098N/A { 'functionName' : 'rebuildIndexWithScript' ,
5098N/A 'functionArguments' : { 'dsBaseDN' : DIRECTORY_INSTANCE_SFX ,
6184N/A 'dsIndexList' : [ 'uid' ]
5098N/A }
5098N/A }
5098N/A </call>
5098N/A
5098N/A <call function="'runFunction'">
5098N/A { 'functionName' : 'StartDsWithScript',
5098N/A 'functionArguments' : { 'location' : STAF_REMOTE_HOSTNAME }
5098N/A }
5098N/A </call>
5098N/A <!--- Check that DS started -->
5098N/A <call function="'isAlive'">
5098N/A {
5098N/A 'noOfLoops' : 10 ,
5098N/A 'noOfMilliSeconds' : 2000
5098N/A }
5098N/A </call>
5098N/A
5098N/A <call function="'testCase_Postamble'"/>
5098N/A </sequence>
5098N/A </testcase>
1914N/A </sequence>
1914N/A <catch exception="'STAXException.LDAP.ModifyException'">
3142N/A <message log="1" level="'fatal'">
3142N/A 'Fatal Error: Failed to alter index for attribute uid'
3142N/A </message>
1914N/A </catch>
1914N/A <catch exception="'STAXException.CLI.RebuildIndex'">
3142N/A <message log="1" level="'fatal'">
3142N/A 'Fatal Error: Failed to rebuild index for attribute uid'
3142N/A </message>
1914N/A </catch>
1914N/A </try>
3853N/A
3853N/A <call function="'testSuite_Postamble'"/>
1914N/A </sequence>
1914N/A </block>
1914N/A </function>
1914N/A
3142N/A
3142N/A
3142N/A <function name="indexes_dynamic_modify" scope="local">
3142N/A <!--
3142N/A This test alters dynamically the uid default index so that it does
3142N/A subString search and then verifies that it worked
3142N/A #@TestMarker indexes
3142N/A #@TestName indexes_dynamic_modify
6184N/A #@TestIssue none
3142N/A #@TestPurpose harden the default indexes
3142N/A #@TestPreamble none
3142N/A #@TestStep iterate through file search.filters
3142N/A #@TestPostamble none
3142N/A #@TestResult Success if entry are indexed correctly
3142N/A -->
3853N/A <block name="'indexes_dynamic_modify'">
3142N/A <sequence>
3853N/A <script>
3853N/A CurrentTestPath['suite'] = STAXCurrentBlock
3853N/A </script>
3853N/A <call function="'testSuite_Preamble'"/>
3853N/A
3142N/A <try>
3142N/A <sequence>
3142N/A <call function="'loopThroughFilters'">
3142N/A { 'filters' : 'before-modify' }
3142N/A </call>
5064N/A
5064N/A <testcase name="getTestCaseName('Modify and rebuild uid index')">
5064N/A <sequence>
5064N/A <call function="'testCase_Preamble'"/>
5064N/A
5064N/A <call function="'runFunction'">
5064N/A { 'functionName' : 'modifyIndex',
5064N/A 'functionMessage' : 'Adding substring index to attribute uid',
5064N/A 'functionArguments' : { 'operation' : 'add',
5064N/A 'indexAttribute' : 'uid',
5064N/A 'indexProperty' : 'index-type',
5064N/A 'indexPropertyValue' : 'substring'
5064N/A }
3142N/A }
5064N/A </call>
5064N/A <call function="'runFunction'">
5064N/A { 'functionName' : 'rebuildIndexWithScript' ,
5064N/A 'functionArguments' :
5064N/A { 'location' : STAF_REMOTE_HOSTNAME,
5064N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
5064N/A 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
5064N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
5064N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
5064N/A 'dsBaseDN' : DIRECTORY_INSTANCE_SFX,
6184N/A 'dsIndexList' : [ 'uid' ]
5064N/A }
5064N/A }
5064N/A </call>
5064N/A
5064N/A <call function="'testCase_Postamble'"/>
5064N/A </sequence>
5064N/A </testcase>
5064N/A
3142N/A <call function="'loopThroughFilters'">
3142N/A { 'filters' : 'after-modify' }
3142N/A </call>
5098N/A
5098N/A <testcase name="getTestCaseName('Restore and rebuild uid index')">
5098N/A <sequence>
5098N/A <call function="'testCase_Preamble'"/>
5098N/A
5098N/A <call function="'runFunction'">
5098N/A { 'functionName' : 'modifyIndex',
5098N/A 'functionMessage' : 'Adding substring index to attribute uid',
5098N/A 'functionArguments' : { 'operation' : 'remove',
5098N/A 'indexAttribute' : 'uid',
5098N/A 'indexProperty' : 'index-type',
5098N/A 'indexPropertyValue' : 'substring'
5098N/A }
5098N/A }
5098N/A </call>
5098N/A <call function="'runFunction'">
5098N/A { 'functionName' : 'StopDsWithScript',
5098N/A 'functionArguments' : { 'location' : STAF_REMOTE_HOSTNAME,
5098N/A 'dsHost' : DIRECTORY_INSTANCE_HOST,
5098N/A 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
5098N/A 'dsBindDN' : DIRECTORY_INSTANCE_DN ,
5098N/A 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
5098N/A }
5098N/A </call>
5098N/A <call function="'runFunction'">
5098N/A { 'functionName' : 'rebuildIndexWithScript' ,
5098N/A 'functionArguments' : { 'dsBaseDN' : DIRECTORY_INSTANCE_SFX ,
6184N/A 'dsIndexList' : [ 'uid' ]
5098N/A }
5098N/A }
5098N/A </call>
5098N/A
5098N/A <call function="'runFunction'">
5098N/A { 'functionName' : 'StartDsWithScript',
5098N/A 'functionArguments' : { 'location' : STAF_REMOTE_HOSTNAME }
5098N/A }
5098N/A </call>
5098N/A <!--- Check that DS started -->
5098N/A <call function="'isAlive'">
5098N/A {
5098N/A 'noOfLoops' : 10 ,
5098N/A 'noOfMilliSeconds' : 2000
5098N/A }
5098N/A </call>
5098N/A
5098N/A <call function="'testCase_Postamble'"/>
5098N/A </sequence>
5098N/A </testcase>
3142N/A </sequence>
3142N/A <catch exception="'STAXException.LDAP.ModifyException'">
3142N/A <message log="1" level="'fatal'">
3142N/A 'Fatal Error: Failed to alter index for attribute uid'
3142N/A </message>
3142N/A </catch>
3142N/A <catch exception="'STAXException.CLI.RebuildIndex'">
3142N/A <message log="1" level="'fatal'">
3142N/A 'Fatal Error: Failed to rebuild index for attribute uid'
3142N/A </message>
3142N/A </catch>
3142N/A </try>
3853N/A
3853N/A <call function="'testSuite_Postamble'"/>
3142N/A </sequence>
3142N/A </block>
3142N/A </function>
3142N/A
3142N/A
3142N/A
1914N/A <function name="indexes_add" scope="local">
1933N/A <!--
3142N/A This test adds a new presence and equality index for l attribute
1933N/A and then verifies that it worked
3142N/A #@TestMarker indexes
3142N/A #@TestName indexes_add
3142N/A #@TestIssue TODO: look up the issue in issue tracker
3142N/A #@TestPurpose check if the user can add her own indexes
3142N/A #@TestPreamble none
3142N/A #@TestStep iterate through filters prior to adding indexes
3142N/A #@TestStep add the indexes
3142N/A #@TestStep iterate through filters after to adding indexes
3142N/A #@TestPostamble none
3142N/A #@TestResult Success if entry are indexed correctly
1933N/A -->
3853N/A <block name="'indexes_add'">
1933N/A <sequence>
3853N/A <script>
3853N/A CurrentTestPath['suite'] = STAXCurrentBlock
3853N/A </script>
3853N/A <call function="'testSuite_Preamble'"/>
3853N/A
1933N/A <try>
1933N/A <sequence>
1933N/A <call function="'loopThroughFilters'">
1933N/A { 'filters' : 'before-add' }
1933N/A </call>
5064N/A
5098N/A <testcase name="getTestCaseName('Add and rebuild l index')">
5064N/A <sequence>
5064N/A <call function="'testCase_Preamble'"/>
5064N/A
5064N/A <call function="'runFunction'">
5064N/A { 'functionName' : 'addIndex',
5064N/A 'functionMessage' : 'Adding presence and equality index to \
5064N/A attribute l',
5064N/A 'functionArguments' : { 'indexAttribute' : 'l',
5064N/A 'indexTypes' : [ 'presence',
5064N/A 'equality' ]
5064N/A }
5064N/A }
5064N/A </call>
5064N/A <call function="'runFunction'">
5064N/A { 'functionName' : 'StopDsWithScript',
5064N/A 'functionArguments' : { 'location' : STAF_REMOTE_HOSTNAME,
5064N/A 'dsHost' : DIRECTORY_INSTANCE_HOST,
5064N/A 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
5064N/A 'dsBindDN' : DIRECTORY_INSTANCE_DN,
5064N/A 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
5064N/A }
5064N/A }
5064N/A </call>
5064N/A <call function="'runFunction'">
5064N/A { 'functionName' : 'rebuildIndexWithScript' ,
5064N/A 'functionArguments' : { 'dsBaseDN' : DIRECTORY_INSTANCE_SFX ,
6184N/A 'dsIndexList' : [ 'l' ]
5064N/A }
5064N/A }
5064N/A </call>
5064N/A <call function="'runFunction'">
5064N/A { 'functionName' : 'StartDsWithScript',
5064N/A 'functionArguments' : { 'location' : STAF_REMOTE_HOSTNAME }
5064N/A }
5064N/A </call>
5064N/A <!--- Check that DS started -->
5064N/A <call function="'isAlive'">
5064N/A {
5064N/A 'noOfLoops' : 10 ,
5064N/A 'noOfMilliSeconds' : 2000
5064N/A }
5064N/A </call>
5064N/A
5064N/A <call function="'testCase_Postamble'"/>
5064N/A </sequence>
5064N/A </testcase>
5064N/A
1933N/A <call function="'loopThroughFilters'">
1933N/A { 'filters' : 'after-add' }
1933N/A </call>
5098N/A
5098N/A <testcase name="getTestCaseName('Remove l index and rebuild all indexes')">
5098N/A <sequence>
5098N/A <call function="'testCase_Preamble'"/>
5098N/A
5098N/A <call function="'runFunction'">
5098N/A { 'functionName' : 'removeIndex',
5098N/A 'functionMessage' : 'Removing index on attribute l' ,
5098N/A 'functionArguments' : { 'indexAttribute' : 'l' }
5098N/A }
5098N/A </call>
5098N/A
5098N/A <call function="'testCase_Postamble'"/>
5098N/A </sequence>
5098N/A </testcase>
1933N/A </sequence>
1933N/A <catch exception="'STAXException.LDAP.AddIndexException'">
3142N/A <message log="1" level="'fatal'">
3142N/A 'Fatal Error: Failed to add index for attribute l'
3142N/A </message>
1933N/A </catch>
1933N/A <catch exception="'STAXException.CLI.RebuildIndex'">
3142N/A <message log="1" level="'fatal'">
3142N/A 'Fatal Error: Failed to rebuild index for attribute l'
3142N/A </message>
1933N/A </catch>
1933N/A </try>
3853N/A
3853N/A <call function="'testSuite_Postamble'"/>
1933N/A </sequence>
1933N/A </block>
1914N/A </function>
1933N/A
3142N/A
3142N/A
3142N/A <function name="indexes_dynamic_add" scope="local">
3142N/A <!--
3142N/A This test adds dynamically a new presence and equality index for l
3142N/A attribute and then verifies that it worked
3142N/A #@TestMarker indexes
3142N/A #@TestName indexes_dynamic_add
6184N/A #@TestIssue none
3142N/A #@TestPurpose check if the user can add her own indexes
3142N/A dynamically
3142N/A #@TestPreamble none
3142N/A #@TestStep iterate through filters prior to adding indexes
3142N/A #@TestStep add the indexes
3142N/A #@TestStep iterate through filters after to adding indexes
3142N/A #@TestPostamble none
3142N/A #@TestResult Success if entry are indexed correctly
3142N/A -->
3853N/A <block name="'indexes_dynamic_add'">
3142N/A <sequence>
3853N/A <script>
3853N/A CurrentTestPath['suite'] = STAXCurrentBlock
3853N/A </script>
3853N/A <call function="'testSuite_Preamble'"/>
3853N/A
3142N/A <try>
3142N/A <sequence>
3142N/A <call function="'loopThroughFilters'">
3142N/A { 'filters' : 'before-add' }
3142N/A </call>
5064N/A
5064N/A <testcase name="getTestCaseName('Add and rebuild l index')">
5064N/A <sequence>
5064N/A <call function="'testCase_Preamble'"/>
5064N/A
5064N/A <call function="'runFunction'">
5064N/A { 'functionName' : 'addIndex',
5064N/A 'functionMessage' : 'Adding presence and equality index to \
5064N/A attribute l',
5064N/A 'functionArguments' : { 'indexAttribute' : 'l',
5064N/A 'indexTypes' : [ 'presence',
5064N/A 'equality' ]
5064N/A }
3142N/A }
5064N/A </call>
5064N/A <call function="'runFunction'">
5064N/A { 'functionName' : 'rebuildIndexWithScript' ,
5064N/A 'functionArguments' :
5064N/A { 'location' : STAF_REMOTE_HOSTNAME,
5064N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
5064N/A 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
5064N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
5064N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
5064N/A 'dsBaseDN' : DIRECTORY_INSTANCE_SFX,
6184N/A 'dsIndexList' : [ 'l' ]
5064N/A }
5064N/A }
5064N/A </call>
5064N/A
5064N/A <call function="'testCase_Postamble'"/>
5064N/A </sequence>
5064N/A </testcase>
5064N/A
3142N/A <call function="'loopThroughFilters'">
5064N/A { 'filters' : 'after-add' }
3142N/A </call>
5098N/A
5098N/A <testcase name="getTestCaseName('Remove l index and rebuild all indexes')">
5098N/A <sequence>
5098N/A <call function="'testCase_Preamble'"/>
5098N/A
5098N/A <call function="'runFunction'">
5098N/A { 'functionName' : 'removeIndex',
5098N/A 'functionMessage' : 'Removing index on attribute l' ,
5098N/A 'functionArguments' : { 'indexAttribute' : 'l' }
5098N/A }
5098N/A </call>
5098N/A
5098N/A <call function="'testCase_Postamble'"/>
5098N/A </sequence>
5098N/A </testcase>
3142N/A </sequence>
3142N/A <catch exception="'STAXException.LDAP.AddIndexException'">
3142N/A <message log="1" level="'fatal'">
3142N/A 'Fatal Error: Failed to add index for attribute l'
3142N/A </message>
3142N/A </catch>
3142N/A <catch exception="'STAXException.CLI.RebuildIndex'">
3142N/A <message log="1" level="'fatal'">
3142N/A 'Fatal Error: Failed to rebuild index for attribute l'
3142N/A </message>
3142N/A </catch>
3142N/A </try>
3853N/A
3853N/A <call function="'testSuite_Postamble'"/>
3142N/A </sequence>
3142N/A </block>
3142N/A </function>
3142N/A
1914N/A
1976N/A <function name="indexes_remove" scope="local">
1976N/A <!--
1976N/A This test does a bunch of searches on the
1976N/A and then verifies that it worked
3142N/A #@TestMarker indexes
3142N/A #@TestName indexes_remove
3142N/A #@TestIssue TODO: look up the issue in issue tracker
3142N/A #@TestPurpose Check if the user can remove indexes
3142N/A #@TestPreamble none
3142N/A #@TestStep iterate through filters prior to removing index
3142N/A #@TestStep remove index
3142N/A #@TestStep iterate through filters after to removing index
3142N/A #@TestPostamble none
3142N/A #@TestResult Success if entry are indexed as expected
1976N/A -->
3853N/A <block name="'indexes_remove'">
1976N/A <sequence>
3853N/A <script>
3853N/A CurrentTestPath['suite'] = STAXCurrentBlock
3853N/A </script>
3853N/A <call function="'testSuite_Preamble'"/>
3853N/A
1976N/A <try>
1976N/A <sequence>
5098N/A <testcase name="getTestCaseName('Add and rebuild l index')">
5098N/A <sequence>
5098N/A <call function="'testCase_Preamble'"/>
5098N/A
5098N/A <call function="'runFunction'">
5098N/A { 'functionName' : 'addIndex',
5098N/A 'functionMessage' : 'Adding presence and equality index to \
5098N/A attribute l',
5098N/A 'functionArguments' : { 'indexAttribute' : 'l',
5098N/A 'indexTypes' : [ 'presence',
5098N/A 'equality' ]
5098N/A }
5098N/A }
5098N/A </call>
5098N/A <call function="'runFunction'">
5098N/A { 'functionName' : 'StopDsWithScript',
5098N/A 'functionArguments' : { 'location' : STAF_REMOTE_HOSTNAME,
5098N/A 'dsHost' : DIRECTORY_INSTANCE_HOST,
5098N/A 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
5098N/A 'dsBindDN' : DIRECTORY_INSTANCE_DN,
5098N/A 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
5098N/A }
5098N/A }
5098N/A </call>
5098N/A <call function="'runFunction'">
5098N/A { 'functionName' : 'rebuildIndexWithScript' ,
5098N/A 'functionArguments' : { 'dsBaseDN' : DIRECTORY_INSTANCE_SFX ,
6184N/A 'dsIndexList' : [ 'l' ]
5098N/A }
5098N/A }
5098N/A </call>
5098N/A <call function="'runFunction'">
5098N/A { 'functionName' : 'StartDsWithScript',
5098N/A 'functionArguments' : { 'location' : STAF_REMOTE_HOSTNAME }
5098N/A }
5098N/A </call>
5098N/A <!--- Check that DS started -->
5098N/A <call function="'isAlive'">
5098N/A {
5098N/A 'noOfLoops' : 10 ,
5098N/A 'noOfMilliSeconds' : 2000
5098N/A }
5098N/A </call>
5098N/A
5098N/A <call function="'testCase_Postamble'"/>
5098N/A </sequence>
5098N/A </testcase>
5098N/A
1976N/A <call function="'loopThroughFilters'">
1976N/A { 'filters' : 'before-remove' }
1976N/A </call>
5064N/A
5064N/A <testcase name="getTestCaseName('Remove l index')">
5064N/A <sequence>
5064N/A <call function="'testCase_Preamble'"/>
5064N/A
5064N/A <call function="'runFunction'">
5064N/A { 'functionName' : 'removeIndex',
5064N/A 'functionMessage' : 'Removing index on attribute l' ,
5064N/A 'functionArguments' : { 'indexAttribute' : 'l' }
5064N/A }
5064N/A </call>
5064N/A
5064N/A <call function="'testCase_Postamble'"/>
5064N/A </sequence>
5064N/A </testcase>
5064N/A
1976N/A <call function="'loopThroughFilters'">
1976N/A { 'filters' : 'after-remove' }
1976N/A </call>
1976N/A </sequence>
1976N/A <catch exception="'STAXException.LDAP.RemoveIndexException'">
3142N/A <message log="1" level="'fatal'">
3142N/A 'Fatal Error: Failed to remove index for attribute l'
3142N/A </message>
1976N/A </catch>
1976N/A </try>
3853N/A
3853N/A <call function="'testSuite_Postamble'"/>
1976N/A </sequence>
1976N/A </block>
1914N/A </function>
1914N/A
1976N/A <function name="indexes_entry_limit">
1976N/A <!--
1976N/A This test does a bunch of searches on the
1976N/A and then verifies that it worked
3142N/A #@TestMarker indexes
3142N/A #@TestName indexes_remove
3142N/A #@TestIssue TODO: look up the issue in issue tracker
3142N/A #@TestPurpose Check if the user can remove indexes
3142N/A #@TestPreamble none
3142N/A #@TestStep iterate through filters prior to removing index
3142N/A #@TestStep remove index
3142N/A #@TestStep iterate through filters after to removing index
3142N/A #@TestPostamble none
3142N/A #@TestResult Success if entry are indexed as expected
1976N/A -->
3853N/A <block name="'indexes_entry_limit'">
1976N/A <sequence>
3853N/A <script>
3853N/A CurrentTestPath['suite'] = STAXCurrentBlock
3853N/A </script>
3853N/A <call function="'testSuite_Preamble'"/>
3853N/A
1976N/A <try>
1976N/A <sequence>
1976N/A <call function="'loopThroughFilters'">
5619N/A { 'filters' : 'before-modify' }
1976N/A </call>
5064N/A
5064N/A <testcase name="getTestCaseName('Modify uid index')">
5064N/A <sequence>
5064N/A <call function="'testCase_Preamble'"/>
5064N/A
5064N/A <call function="'runFunction'">
5064N/A { 'functionName' : 'modifyIndex',
5064N/A 'functionMessage' : 'Modify index entry limit on attribute \
5064N/A uid' ,
5064N/A 'functionArguments' : { 'operation' : 'set',
5064N/A 'indexAttribute' : 'uid',
5064N/A 'indexProperty' : 'index-entry-limit',
5064N/A 'indexPropertyValue' : '3'
5064N/A }
5064N/A }
5064N/A </call>
5064N/A
5064N/A <call function="'testCase_Postamble'"/>
5064N/A </sequence>
5064N/A </testcase>
5064N/A
1976N/A <call function="'loopThroughFilters'">
5619N/A { 'filters' : 'before-modify' }
1976N/A </call>
1976N/A </sequence>
1976N/A <catch exception="'STAXException.LDAP.RemoveIndexException'">
3142N/A <message log="1" level="'fatal'">
3142N/A 'Fatal Error: Failed to remove index for attribute l'
3142N/A </message>
1976N/A </catch>
1976N/A </try>
3853N/A
3853N/A <call function="'testSuite_Postamble'"/>
1976N/A </sequence>
1976N/A </block>
1914N/A </function>
1976N/A
2055N/A <function name="indexes_vlv_add">
2055N/A <!--
2055N/A This test does a bunch of searches on the
2055N/A and then verifies that it worked
3142N/A #@TestMarker indexes
3142N/A #@TestName indexes_vlv_add
3142N/A #@TestIssue TODO: look up the issue in issue tracker
3142N/A #@TestPurpose Check if the user can remove indexes
3142N/A #@TestPreamble none
3142N/A #@TestStep iterate through filters prior to removing index
3142N/A #@TestStep remove index
3142N/A #@TestStep iterate through filters after to removing index
3142N/A #@TestPostamble none
3142N/A #@TestResult Success if entry are indexed as expected
2055N/A -->
3853N/A <block name="'indexes_vlv_add'">
2055N/A <sequence>
3853N/A <script>
3853N/A CurrentTestPath['suite'] = STAXCurrentBlock
3853N/A </script>
3853N/A <call function="'testSuite_Preamble'"/>
3853N/A
2055N/A <try>
2055N/A <sequence>
2055N/A <call function="'loopThroughFilters'">
5619N/A { 'filters' : 'before-modify' }
2055N/A </call>
5064N/A
5064N/A <testcase name="getTestCaseName('Modify uid index')">
5064N/A <sequence>
5064N/A <call function="'testCase_Preamble'"/>
5064N/A
5064N/A <call function="'runFunction'">
5064N/A { 'functionName' : 'modifyIndex',
5064N/A 'functionMessage' : 'Modify index entry limit on attribute \
5064N/A uid' ,
5064N/A 'functionArguments' : { 'operation' : 'set',
5064N/A 'indexAttribute' : 'uid',
5064N/A 'indexProperty' : 'index-entry-limit' ,
5064N/A 'indexPropertyValue' : '3'
5064N/A }
5064N/A }
5064N/A </call>
5064N/A
5064N/A <call function="'testCase_Postamble'"/>
5064N/A </sequence>
5064N/A </testcase>
5064N/A
2055N/A <call function="'loopThroughFilters'">
5619N/A { 'filters' : 'before-modify' }
2055N/A </call>
2055N/A </sequence>
2055N/A <catch exception="'STAXException.LDAP.RemoveIndexException'">
3142N/A <message log="1" level="'fatal'">
3142N/A 'Fatal Error: Failed to remove index for attribute l'
3142N/A </message>
2055N/A </catch>
2055N/A </try>
3853N/A
3853N/A <call function="'testSuite_Postamble'"/>
2055N/A </sequence>
2055N/A </block>
2055N/A </function>
2055N/A
1914N/A
1914N/A <function name="loopThroughFilters" scope="local">
1914N/A <function-map-args>
1914N/A <function-arg-def name="filters" type="required" />
1914N/A </function-map-args>
1625N/A <sequence>
1625N/A <script>
1625N/A class indexTest:
3142N/A "Describes an index test with indexed attribute, filter to test with \
3142N/A and expected behaviour"
4616N/A def __init__(self, attribute,testName,filter,expectedValue,isIndexed):
1625N/A self.attribute = attribute
1625N/A self.name = testName
1625N/A self.filter = filter
1625N/A self.rc = expectedValue
2067N/A self.isIndexed=re.compile(r'[\r\n]').sub('',isIndexed)
1625N/A self.status='fail'
1625N/A
1625N/A def getAttribute(self):
1625N/A return self.attribute
1625N/A
1625N/A def getName(self):
1625N/A return self.name
1625N/A
1625N/A def getFilter(self):
1625N/A return self.filter
1625N/A
1625N/A def getRC(self):
1625N/A return self.rc
1625N/A
1625N/A def getSearchString(self):
1625N/A if self.isIndexed.startswith('NOT'):
1625N/A return 'NOT'
1625N/A else:
1933N/A return 'INDEX:%s' % (self.attribute)
1625N/A
5618N/A def setPass(self):
1625N/A self.status='pass'
1625N/A
1625N/A def getStatus(self):
1625N/A return self.status
1625N/A
1625N/A def desc(self):
2067N/A description = 'test:: name=[%s]\n' % self.name
2067N/A description += 'test:: attribute=[%s]\n' % self.attribute
2067N/A description += 'test:: filter=[%s]\n' % self.filter
2067N/A description += 'test:: rc=[%s]\n' % self.rc
2067N/A description += 'test:: indexed=[%s]\n' % self.isIndexed
1625N/A return description
1625N/A
1625N/A indexTests = []
1625N/A
1914N/A f = open('%s/testcases/indexes/%s.filters' % (TESTS_DIR,filters),'r')
1625N/A for line in f.readlines():
1625N/A if line.startswith('#'):
1625N/A continue
1625N/A else:
1625N/A testLine = line.split(' ')
3142N/A indexTests.append(indexTest(testLine[0], testLine[1], testLine[2],
4616N/A testLine[3], testLine[4]))
3176N/A f.close()
1672N/A
1914N/A indexTestNumber=0
1672N/A previousTestName=''
1672N/A testNumber=0
1625N/A </script>
1625N/A <iterate var="test" in="indexTests">
1625N/A <sequence>
1672N/A <script>
1914N/A indexTestNumber=indexTestNumber+1
1672N/A if previousTestName != test.getName():
1672N/A previousTestName=test.getName()
1672N/A testNumber=0
1672N/A
1672N/A </script>
3853N/A <testcase name="getTestCaseName('%s: %03d-%03d.%s: %s%02d')
3853N/A % (filters, len(indexTests)-indexTestNumber, indexTestNumber,
3853N/A test.getAttribute(), test.getName(), testNumber)">
3853N/A
1625N/A <sequence>
5064N/A <call function="'testCase_Preamble'"/>
1875N/A <message log="1" level="'trace'">
3142N/A 'Searching attribute [%s] with filter[%s]' \
3142N/A % (test.getAttribute(),test.getFilter())
1625N/A </message>
1625N/A <call function="'SearchObject'">
3142N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
3142N/A 'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
3142N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
3142N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
3142N/A 'dsBaseDN' : 'ou=People,dc=example,%s' \
3142N/A % DIRECTORY_INSTANCE_SFX ,
3142N/A 'dsFilter' : '%s' % test.getFilter(),
5064N/A 'attributes' : 'debugsearchindex'
3142N/A }
1625N/A </call>
5064N/A <if expr="RC == 0">
5064N/A <sequence>
5064N/A <script>
5064N/A searchReturnCode, searchResultString = STAXResult[0]
5064N/A # chop off the first line that contains the dn
5064N/A searchResultString = re.compile(r'^dn:.*\n?').sub('',
5064N/A searchResultString)
5064N/A # join multiple lines into a single one
5064N/A searchResultString = re.compile(r'[ \t]*\r?\n[ \t]*').sub('',
5064N/A searchResultString)
5064N/A srt=searchResultString.split('[')[1]
5064N/A if (str(searchReturnCode) == str(test.getRC())) and \
5064N/A srt.startswith(test.getSearchString()):
5618N/A test.setPass()
5064N/A </script>
5064N/A <message level="'trace'">
5064N/A '%s\nsearchReturnCode=[%s]\nldapsearch return \
5064N/A string=[%s]\nchunk to parse=[%s]\nstring looked for=[%s]' \
5064N/A % (test.desc(), searchReturnCode, searchResultString, srt,
5064N/A test.getSearchString())
5064N/A </message>
5064N/A </sequence>
5064N/A </if>
5064N/A <tcstatus result="test.getStatus()"/>
5064N/A <call function="'testCase_Postamble'"/>
1672N/A <script>
1672N/A testNumber=testNumber+1
1672N/A </script>
1625N/A </sequence>
1625N/A </testcase>
1625N/A </sequence>
1625N/A </iterate>
1625N/A </sequence>
1625N/A </function>
1625N/A
1625N/A <!-- Setup the instance for indexes tests -->
1875N/A <function name="indexes_setup">
3853N/A <block name="'indexes_setup'">
3853N/A <sequence>
3853N/A <script>
3853N/A CurrentTestPath['suite'] = STAXCurrentBlock
3853N/A </script>
3853N/A <call function="'testSuite_Preamble'"/>
3853N/A
5064N/A <testcase name="getTestCaseName('Setup')">
5064N/A <sequence>
5064N/A <call function="'testCase_Preamble'"/>
5064N/A
5064N/A <call function="'runFunction'">
5064N/A { 'functionName' : 'createTopology',
5064N/A 'functionMessage' : 'Create DS topology as described in config.py',
5064N/A 'functionArguments' : { 'initialiseInstance' : True }
5064N/A }
5064N/A </call>
5064N/A <call function="'runFunction'">
5064N/A { 'functionName' : 'StartDsWithScript' ,
5064N/A 'functionMessage' : 'Start DS to run on port %s' \
5064N/A % (DIRECTORY_INSTANCE_PORT) ,
5064N/A 'functionArguments' : { 'location' : STAF_REMOTE_HOSTNAME }
5064N/A }
5064N/A </call>
5064N/A <call function="'runFunction'">
5064N/A { 'functionName' : 'isAlive',
5064N/A 'functionMessage' : 'Checking if the server is available',
5064N/A 'functionArguments' : { 'noOfLoops' : 10,
5064N/A 'noOfMilliSeconds' : 2000
5064N/A }
5064N/A }
5064N/A </call>
5064N/A
5064N/A <call function="'testCase_Postamble'"/>
5064N/A </sequence>
5064N/A </testcase>
3853N/A
3853N/A <call function="'testSuite_Postamble'"/>
3853N/A </sequence>
3853N/A </block>
1625N/A </function>
1625N/A
1625N/A <!-- cleanup after the tests -->
1875N/A <function name="indexes_cleanup">
3853N/A <block name="'indexes_cleanup'">
3853N/A <sequence>
3853N/A <script>
3853N/A CurrentTestPath['suite'] = STAXCurrentBlock
3853N/A </script>
3853N/A <call function="'testSuite_Preamble'"/>
3853N/A
5064N/A <testcase name="getTestCaseName('Cleanup')">
5064N/A <sequence>
5064N/A <call function="'testCase_Preamble'"/>
5064N/A
5064N/A <call function="'runFunction'">
5064N/A { 'functionName' : 'StopDsWithScript' ,
5064N/A 'functionMessage' : 'Stop DS running on port %s' \
5064N/A % (DIRECTORY_INSTANCE_PORT),
5064N/A 'functionArguments' : { 'location' : STAF_REMOTE_HOSTNAME,
5064N/A 'dsHost' : DIRECTORY_INSTANCE_HOST,
5064N/A 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
5064N/A 'dsBindDN' : DIRECTORY_INSTANCE_DN,
5064N/A 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
5064N/A }
5064N/A </call>
5064N/A <call function="'runFunction'">
5064N/A { 'functionName' : 'removeTopology',
5064N/A 'functionMessage' : 'Remove DS topology created for the Test Suite'
5064N/A }
5064N/A </call>
5064N/A
5064N/A <call function="'testCase_Postamble'"/>
5064N/A </sequence>
5064N/A </testcase>
3853N/A
3853N/A <call function="'testSuite_Postamble'"/>
3853N/A </sequence>
3853N/A </block>
1625N/A </function>
1625N/A</stax>