<?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-2010 Sun Microsystems, Inc.
! Portions Copyright 2011-2013 ForgeRock AS.
! -->
<stax>
<defaultcall function="fractional-replication_basic"/>
<function name="fractional-replication_basic">
<sequence>
<block name="'basic'">
<try>
<sequence>
<!--- Test Suite information
#@TestSuiteName fractional-replication basic
#@TestSuitePurpose Verify the basic fractional replication setup
#@TestSuiteID basic tests
#@TestSuiteGroup basic
#@TestMarker fractional-replication basic
#@TestGroup fractional-replication
#@TestScript basic.xml
#@TestHTMLLink http://opends.dev.java.net/
-->
<script>
if not CurrentTestPath.has_key('group'):
CurrentTestPath['group']='fractional-replication'
CurrentTestPath['suite']=STAXCurrentBlock
</script>
<call function="'testSuite_Preamble'"/>
<try>
<sequence>
<!-- fractional-replication setup -->
<import machine="STAF_LOCAL_HOSTNAME"
file="'%s/testcases/fractional-replication/fractional-replication_setup.xml'
% (TESTS_DIR)"/>
<call function="'fractional-replication_setup'" />
<script>
Pservers = _topologyServerList
ldapPservers = [ '%s:%s' % (s.getHostname(),s.getPort()) for s in Pservers]
fractionalTypes = ['fractional-include','fractional-exclude']
</script>
<!-- Retrieve replication-domain name -->
<paralleliterate var="s" in="Pservers">
<sequence>
<call function="'dsconfig'">
{ 'location' : s.getHostname(),
'dsPath' : '%s/%s' % (s.getDir(),OPENDSNAME),
'dsInstanceHost' : s.getHostname(),
'dsInstanceAdminPort' : s.getAdminPort(),
'dsInstanceDn' : s.getRootDn(),
'dsInstancePswd' : s.getRootPwd(),
'subcommand' : 'list-replication-domains',
'objectType' : 'provider-name',
'objectName' : 'Multimaster Synchronization',
}
</call>
<if expr="RC == 0">
<sequence>
<script>
replicationDomains = STAXResult[0][1]
for line in replicationDomains.splitlines():
if line.startswith(synchroSuffix):
colSplit = line.split(':')
domain = colSplit[0].strip()
serverId = colSplit[2].strip()
ls = '%s:%s' % (s.getHostname(),s.getPort())
domainMap[ls] = (domain,serverId)
break
</script>
</sequence>
</if>
</sequence>
</paralleliterate>
<script>
replDomainSuffix = 'cn=o_example,cn=replication,cn=monitor'
</script>
<message level="'debug'">'domainMap=%s' % domainMap</message>
<script>
testsList=[]
testsList.append('basic_include')
testsList.append('basic_exclude')
</script>
<!-- Execute the Tests -->
<iterate var="__test" in="testsList">
<sequence>
<call function="'%s' % (__test)" />
</sequence>
</iterate>
</sequence>
<finally>
<message>'Test Cases Completed.'</message>
</finally>
</try>
</sequence>
<finally>
<sequence>
<!-- Test Suite Cleanup -->
<message>'Finally: Global Cleanup.'</message>
<try>
<sequence>
<!-- fractional-replication cleanup -->
<import machine="STAF_LOCAL_HOSTNAME"
file="'%s/testcases/fractional-replication/fractional-replication_cleanup.xml'
% (TESTS_DIR)"/>
<call function="'fractional-replication_cleanup'" />
</sequence>
<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>
<function name="basic_exclude">
<!--- Test Case information
#@TestMarker fractional-replication basic
#@TestName basic fractional-exclude
#@TestID basic fractional-exclude
#@TestPurpose basic fractional-exclude functionality
#@TestPreamble
#@TestSteps ...
#@TestPostamble
#@TestResult Success if test replica contains filtered data
-->
<testcase name="getTestCaseName('basic fractional-exclude')">
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'replicationStatus'">
{ "server" : Pservers[0],
"replicationDomainSuffix" : replDomainSuffix,
}
</call>
<!-- set fractional-exclude on server 2 -->
<call function="'set-ops-fractional-replication-attributes'">
{
"replicationDomain" : domainMap[ldapPservers[1]][0],
"server" : Pservers[1],
"include" : [('reset','')],
"exclude" : [('set','*:description,0.9.2342.19200300.100.1.60')],
"expectedRC" : 0
}
</call>
<script>
keptAttributes = [ 'cn', 'dn', 'employeeNumber', 'givenName',
'initials', 'l', 'mail', 'mobile', 'objectClass',
'o', 'ou', 'pager', 'postalAddress',
'sn', 'st', 'street', 'telephoneNumber',
'uid', 'userPassword', 'postalCode'
]
</script>
<!-- verify we have Bad Generation ID -->
<call function="'replicationStatus'">
{ "server" : Pservers[1],
"replicationDomainSuffix" : replDomainSuffix,
}
</call>
<if expr="len(STAXResult) == 3 and STAXResult[1].find('Bad generation id') != -1">
<call function="'testPassed'"/>
<else>
<call function="'testFailed'"/>
</else>
</if>
<call function="'getNumberOfEntries'">
{ "server" : Pservers[1],
"backend" : "userRoot",
"domain" : "o=example",
}
</call>
<call function="'basic_initialization'"/>
<call function="'basic_add'">
{ 'masterEntry' : '%s/fractional-replication/basic-masterAdd.ldif' \
% Pservers[0].getDataDir(),
'replicaEntry' : '%s/fractional-replication/basic-replicaExcludeAdd.ldif' \
% Pservers[1].getDataDir()
}
</call>
<call function="'basic_modify'"/>
<call function="'basic_modifyDN'"/>
<call function="'basic_onlineImport'"/>
</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>
</testcase>
</function>
<function name="basic_include">
<!--- Test Case information
#@TestMarker fractional-replication basic
#@TestName basic fractional-include
#@TestID basic fractional-include
#@TestPurpose basic fractional-include functionality
#@TestPreamble
#@TestSteps ...
#@TestPostamble
#@TestResult Success if test replica contains filtered data
-->
<testcase name="getTestCaseName('basic fractional-include')">
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'replicationStatus'">
{ "server" : Pservers[0],
"replicationDomainSuffix" : replDomainSuffix,
}
</call>
<!-- set fractional-include on server 2 -->
<call function="'set-ops-fractional-replication-attributes'">
{
"replicationDomain" : domainMap[ldapPservers[1]][0],
"server" : Pservers[1],
"include" : [('set','*:description')],
"exclude" : [('reset','')],
"expectedRC" : 0
}
</call>
<script>
keptAttributes = ['dn','sn','objectClass','description',
'cn','ou','uid','o',
'ds-sync-generation-id', 'entryUUID'
]
</script>
<!-- verify we have Bad Generation ID -->
<call function="'replicationStatus'">
{ "server" : Pservers[1],
"replicationDomainSuffix" : replDomainSuffix,
}
</call>
<if expr="len(STAXResult) == 3 and STAXResult[1].find('Bad generation id') != -1">
<call function="'testPassed'"/>
<else>
<call function="'testFailed'"/>
</else>
</if>
<call function="'getNumberOfEntries'">
{ "server" : Pservers[1],
"backend" : "userRoot",
"domain" : "o=example",
}
</call>
<call function="'basic_initialization'"/>
<call function="'basic_add'">
{ 'masterEntry' : '%s/fractional-replication/basic-masterAdd.ldif' \
% Pservers[0].getDataDir(),
'replicaEntry' : '%s/fractional-replication/basic-replicaIncludeAdd.ldif' \
% Pservers[1].getDataDir()
}
</call>
<call function="'basic_modify'"/>
<call function="'basic_modifyDN'"/>
<call function="'basic_onlineImport'"/>
</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>
</testcase>
</function>
<function name="basic_initialization">
<!--- Test Case information
#@TestMarker fractional-replication basic
#@TestName basic initialization
#@TestID basic initialization
#@TestPurpose check fractional-include Bad Generation ID -> Normal status
#@TestPreamble
#@TestSteps ...
#@TestPostamble
#@TestResult Success if test replica contains filtered data
-->
<testcase name="getTestCaseName('basic initialization')">
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'stopServers'">
[ Pservers ]
</call>
<!-- server 1 import basic-master.ldif -->
<call function="'ImportLdifWithScript'">
{ "location" : Pservers[0].getHostname(),
"dsPath" : '%s/%s' % (Pservers[0].getDir(),OPENDSNAME),
"backEnd" : "userRoot",
"templateFile" : "%s/fractional-replication/basic-master.template" \
% Pservers[0].getDataDir(),
"replaceExisting" : True,
}
</call>
<!-- all Pservers : start -->
<call function="'startServers'">
[ Pservers ]
</call>
<!-- Check some data was imported into Directory Server -->
<message>
'Checking import on %s folder %s.' % (Pservers[0].getHostname(),Pservers[0].getDir())
</message>
<call function="'checkImport'">
{ 'location' : Pservers[0].getHostname(),
'dsPath' : '%s/%s' \
% (Pservers[0].getDir(),OPENDSNAME),
'dsHost' : Pservers[0].getHostname(),
'dsAdminPort' : Pservers[0].getAdminPort(),
'dsPort' : Pservers[0].getPort(),
'dsDn' : Pservers[0].getRootDn(),
'dsPswd' : Pservers[0].getRootPwd(),
'startDS' : 'no',
'expectedEntries' : ['uid=user.0,ou=People,o=example',
'uid=user.49,ou=People,o=example',
'uid=user.35,ou=People,o=example'
]
}
</call>
<call function="'getNumberOfEntries'">
{ "server" : Pservers[0],
"backend" : "userRoot",
"domain" : "o=example",
}
</call>
<call function="'getNumberOfEntries'">
{ "server" : Pservers[1],
"backend" : "userRoot",
"domain" : "o=example",
}
</call>
<!-- server 1 : initialize server 1 from server 2 -->
<call function="'initializeReplication'">
{ 'location' : Pservers[0].getHostname(),
'dsPath' : '%s/%s' % (Pservers[0].getDir(),OPENDSNAME),
'sourceInstanceHost' : Pservers[0].getHostname(),
'sourceInstanceAdminPort' : Pservers[0].getAdminPort(),
'replicationDnList' : ['o=example']
}
</call>
<call function="'ldapsearchVerifyFrac'">
{ 'servers' : Pservers,
'keptAttributes' : keptAttributes
}
</call>
<if expr="RC == 0">
<call function="'testPassed'"/>
<else>
<call function="'testFailed'"/>
</else>
</if>
</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>
</testcase>
</function>
<function name="basic_onlineImport">
<!--- Test Case information
#@TestMarker fractional-replication basic
#@TestName basic online import
#@TestID basic online import
#@TestPurpose add entries with a online import
#@TestPreamble
#@TestSteps online import data on Master
#@TestSteps online import data on Replica
#@TestPostamble
#@TestResult Success add on both master and replica is
correctly filtered
-->
<testcase name="getTestCaseName('basic online import')">
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'replicationStatus'">
{ "server" : Pservers[1],
"replicationDomainSuffix" : replDomainSuffix,
}
</call>
<script>
thisDataDir1="%s/fractional-replication" \
% Pservers[0].getDataDir()
thisDataDir2="%s/fractional-replication" \
% Pservers[1].getDataDir()
thisTempdir1=Pservers[0].getTmpDir()
thisTempdir2=Pservers[1].getTmpDir()
</script>
<call function="'ImportLdifWithScript'">
{ 'location' : Pservers[0].getHostname(),
'dsPath' : '%s/%s' % (Pservers[0].getDir(),OPENDSNAME),
'dsInstanceHost' : Pservers[0].getHostname(),
'dsInstanceAdminPort' : Pservers[0].getAdminPort(),
'dsInstanceDn' : Pservers[0].getRootDn(),
'dsInstancePswd' : Pservers[0].getRootPwd(),
'backEnd' : 'userRoot',
'append' : True,
'rejectFile' : '%s/basic-masterOnlineImport.rejected' % thisTempdir1,
'overwriteFile' : True,
'templateFile' : '%s/basic-masterOnlineImport.template' % \
thisDataDir1
}
</call>
<call function="'ImportLdifWithScript'">
{ 'location' : Pservers[1].getHostname(),
'dsPath' : '%s/%s' % (Pservers[1].getDir(),OPENDSNAME),
'dsInstanceHost' : Pservers[1].getHostname(),
'dsInstanceAdminPort' : Pservers[1].getAdminPort(),
'dsInstanceDn' : Pservers[1].getRootDn(),
'dsInstancePswd' : Pservers[1].getRootPwd(),
'backEnd' : 'userRoot',
'append' : True,
'rejectFile' : '%s/basic-masterOnlineImport.rejected' % thisTempdir2,
'overwriteFile' : True,
'templateFile' : '%s/basic-masterOnlineImport.template' % \
thisDataDir2
}
</call>
<call function="'replicationStatus'">
{ "server" : Pservers[1],
"replicationDomainSuffix" : replDomainSuffix,
}
</call>
<if expr="len(STAXResult) == 3 and STAXResult[1].find('Bad generation id') != -1">
<sequence>
<call function="'testFailed'"/>
<break/>
</sequence>
<else>
<sequence>
<!-- Check some data was imported into Directory Server -->
<call function="'checkImport'">
{ 'location' : Pservers[0].getHostname(),
'dsPath' : '%s/%s' % (Pservers[0].getDir(),OPENDSNAME),
'dsHost' : Pservers[0].getHostname(),
'dsAdminPort' : Pservers[0].getAdminPort(),
'dsPort' : Pservers[0].getPort(),
'dsDn' : Pservers[0].getRootDn(),
'dsPswd' : Pservers[0].getRootPwd(),
'startDS' : 'no',
'expectedEntries' : ['uid=user.0,ou=masterOnlineImport,o=example',
'uid=user.2,ou=masterOnlineImport,o=example',
'uid=user.4,ou=masterOnlineImport,o=example'
],
}
</call>
<call function="'checkImport'">
{ 'location' : Pservers[1].getHostname(),
'dsPath' : '%s/%s' % (Pservers[1].getDir(),OPENDSNAME),
'dsHost' : Pservers[1].getHostname(),
'dsAdminPort' : Pservers[1].getAdminPort(),
'dsPort' : Pservers[1].getPort(),
'dsDn' : Pservers[1].getRootDn(),
'dsPswd' : Pservers[1].getRootPwd(),
'startDS' : 'no',
'expectedEntries' : ['uid=user.0,ou=masterOnlineImport,o=example',
'uid=user.2,ou=masterOnlineImport,o=example',
'uid=user.4,ou=masterOnlineImport,o=example'
],
}
</call>
</sequence>
</else>
</if>
<call function="'ldapsearchVerifyFrac'">
{ 'servers' : Pservers,
'keptAttributes' : keptAttributes
}
</call>
<if expr="RC == 0">
<call function="'testPassed'"/>
<else>
<call function="'testFailed'"/>
</else>
</if>
</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>
</testcase>
</function>
<function name="basic_add">
<function-map-args>
<function-required-arg name="masterEntry"/>
<function-required-arg name="replicaEntry"/>
</function-map-args>
<!--- Test Case information
#@TestMarker fractional-replication basic
#@TestName basic add operation
#@TestID basic add operation
#@TestPurpose check add operation
#@TestPreamble
#@TestSteps ...
#@TestPostamble
#@TestResult Success add on both master and replica is
correctly filtered
-->
<testcase name="getTestCaseName('basic add operation')">
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<!-- adding entry with filterable attributes in master -->
<call function="'addEntry'">
{ 'location' : Pservers[0].getHostname(),
'dsPath' : '%s/%s' % (Pservers[0].getDir(),OPENDSNAME),
'dsInstanceHost' : Pservers[0].getHostname(),
'dsInstancePort' : Pservers[0].getPort(),
'dsInstanceDn' : Pservers[0].getRootDn(),
'dsInstancePswd' : Pservers[0].getRootPwd(),
'entryToBeAdded' : masterEntry,
}
</call>
<call function="'SearchObject'">
{ 'location' : Pservers[0].getHostname(),
'dsPath' : '%s/%s' % (Pservers[0].getDir(),OPENDSNAME),
'dsInstanceHost' : Pservers[0].getHostname(),
'dsInstancePort' : Pservers[0].getPort(),
'dsInstanceDn' : Pservers[0].getRootDn(),
'dsInstancePswd' : Pservers[0].getRootPwd(),
'dsBaseDN' : 'uid=added-user.0,ou=People,o=example',
'dsFilter' : 'objectclass=*',
'extraParams' : '-s base' }
</call>
<call function="'ldapsearchVerifyFrac'">
{ 'servers' : Pservers,
'keptAttributes' : keptAttributes
}
</call>
<if expr="RC == 0">
<sequence>
<call function="'testPassed'"/>
<!-- Delete previously added entry -->
<call function="'ldapDeleteWithScript'">
{ 'location' : Pservers[0].getHostname(),
'dsPath' : '%s/%s' % (Pservers[0].getDir(),OPENDSNAME),
'dsInstanceHost' : Pservers[0].getHostname(),
'dsInstancePort' : Pservers[0].getPort(),
'dsInstanceDn' : Pservers[0].getRootDn(),
'dsInstancePswd' : Pservers[0].getRootPwd(),
'dsDn' : ['uid=added-user.0,ou=People,o=example'],
}
</call>
</sequence>
<else>
<call function="'testFailed'"/>
</else>
</if>
<!-- adding entry with filterable attributes in replica -->
<call function="'addEntry'">
{ 'location' : Pservers[1].getHostname(),
'dsPath' : '%s/%s' % (Pservers[1].getDir(),OPENDSNAME),
'dsInstanceHost' : Pservers[1].getHostname(),
'dsInstancePort' : Pservers[1].getPort(),
'dsInstanceDn' : Pservers[1].getRootDn(),
'dsInstancePswd' : Pservers[1].getRootPwd(),
'entryToBeAdded' : masterEntry,
'expectedRC' : 53
}
</call>
<!-- adding entry without filterable attributes in replica -->
<call function="'addEntry'">
{ 'location' : Pservers[1].getHostname(),
'dsPath' : '%s/%s' % (Pservers[1].getDir(),OPENDSNAME),
'dsInstanceHost' : Pservers[1].getHostname(),
'dsInstancePort' : Pservers[1].getPort(),
'dsInstanceDn' : Pservers[1].getRootDn(),
'dsInstancePswd' : Pservers[1].getRootPwd(),
'entryToBeAdded' : replicaEntry
}
</call>
<call function="'SearchObject'">
{ 'location' : Pservers[1].getHostname(),
'dsPath' : '%s/%s' % (Pservers[1].getDir(),OPENDSNAME),
'dsInstanceHost' : Pservers[1].getHostname(),
'dsInstancePort' : Pservers[1].getPort(),
'dsInstanceDn' : Pservers[1].getRootDn(),
'dsInstancePswd' : Pservers[1].getRootPwd(),
'dsBaseDN' : 'cn=added-user.1,ou=People,o=example',
'dsFilter' : 'objectclass=*',
'extraParams' : '-s base' }
</call>
<if expr="RC == 0">
<sequence>
<call function="'ldapsearchVerifyFrac'">
{ 'servers' : Pservers,
'keptAttributes' : keptAttributes
}
</call>
<if expr="RC == 0">
<sequence>
<call function="'testPassed'"/>
<!-- Delete previously added entry -->
<call function="'ldapDeleteWithScript'">
{ 'location' : Pservers[1].getHostname(),
'dsPath' : '%s/%s' % (Pservers[1].getDir(),OPENDSNAME),
'dsInstanceHost' : Pservers[1].getHostname(),
'dsInstancePort' : Pservers[1].getPort(),
'dsInstanceDn' : Pservers[1].getRootDn(),
'dsInstancePswd' : Pservers[1].getRootPwd(),
'dsDn' : ['cn=added-user.1,ou=People,o=example'],
}
</call>
</sequence>
<else>
<call function="'testFailed'"/>
</else>
</if>
</sequence>
</if>
</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>
</testcase>
</function>
<function name="basic_modify">
<!--- Test Case information
#@TestMarker fractional-replication basic
#@TestName basic modify operation
#@TestID basic modify operation
#@TestPurpose check modify operation
#@TestPreamble
#@TestSteps ...
#@TestPostamble
#@TestResult Success modify on both master and replica is
correctly filtered
-->
<testcase name="getTestCaseName('basic modify operation')">
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<script>
thisDataDir1="%s/fractional-replication" \
% Pservers[0].getDataDir()
</script>
<call function="'ldapModifyWithScript'">
{ 'location' : Pservers[0].getHostname(),
'dsPath' : '%s/%s' % (Pservers[0].getDir(),OPENDSNAME),
'dsInstanceHost' : Pservers[0].getHostname(),
'dsInstancePort' : Pservers[0].getPort(),
'dsInstanceDn' : Pservers[0].getRootDn(),
'dsInstancePswd' : Pservers[0].getRootPwd(),
'dsFilename' : '%s/basic-masterModify.ldif' \
% thisDataDir1
}
</call>
<call function="'SearchObject'">
{ 'location' : Pservers[0].getHostname(),
'dsPath' : '%s/%s' % (Pservers[0].getDir(),OPENDSNAME),
'dsInstanceHost' : Pservers[0].getHostname(),
'dsInstancePort' : Pservers[0].getPort(),
'dsInstanceDn' : Pservers[0].getRootDn(),
'dsInstancePswd' : Pservers[0].getRootPwd(),
'dsBaseDN' : 'uid=user.0,ou=People,o=example',
'dsFilter' : 'objectclass=*',
'attributes' : 'postalCode',
'extraParams' : '-s base' }
</call>
<call function="'ldapsearchVerifyFrac'">
{ 'servers' : Pservers,
'keptAttributes' : keptAttributes
}
</call>
<if expr="RC == 0">
<call function="'testPassed'"/>
<else>
<call function="'testFailed'"/>
</else>
</if>
</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>
</testcase>
</function>
<function name="basic_modifyDN">
<!--- Test Case information
#@TestMarker fractional-replication basic
#@TestName basic modifyDN operation
#@TestID basic modifyDN operation
#@TestPurpose check modifyDN operation
#@TestPreamble
#@TestSteps ...
#@TestPostamble
#@TestResult Success modifyDN on both master and replica is
correctly filtered
-->
<testcase name="getTestCaseName('basic modifyDN operation')">
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<script>
thisDataDir1 = "%s/fractional-replication" \
% Pservers[0].getDataDir()
</script>
<call function="'addEntry'">
{ 'location' : Pservers[0].getHostname(),
'dsPath' : '%s/%s' % (Pservers[0].getDir(),OPENDSNAME),
'dsInstanceHost' : Pservers[0].getHostname(),
'dsInstancePort' : Pservers[0].getPort(),
'dsInstanceDn' : Pservers[0].getRootDn(),
'dsInstancePswd' : Pservers[0].getRootPwd(),
'entryToBeAdded' : '%s/basic-masterModifyDN.ldif' \
% thisDataDir1
}
</call>
<call function="'SearchObject'">
{ 'location' : Pservers[0].getHostname(),
'dsPath' : '%s/%s' % (Pservers[0].getDir(),OPENDSNAME),
'dsInstanceHost' : Pservers[0].getHostname(),
'dsInstancePort' : Pservers[0].getPort(),
'dsInstanceDn' : Pservers[0].getRootDn(),
'dsInstancePswd' : Pservers[0].getRootPwd(),
'dsBaseDN' : 'uid=user.0,ou=A,ou=masterModifyDN,o=example',
'dsFilter' : 'objectclass=*',
'extraParams' : '-s base' }
</call>
<call function="'ldapsearchVerifyFrac'">
{ 'servers' : Pservers,
'keptAttributes' : keptAttributes
}
</call>
<!-- modify the RDN and delete old one -->
<call function="'modifyDn'">
{ 'location' : Pservers[0].getHostname(),
'dsPath' : '%s/%s' % (Pservers[0].getDir(),OPENDSNAME),
'dsInstanceHost' : Pservers[0].getHostname(),
'dsInstancePort' : Pservers[0].getPort(),
'dsInstanceDn' : Pservers[0].getRootDn(),
'dsInstancePswd' : Pservers[0].getRootPwd(),
'DNToModify' : 'uid=user.0,ou=A,ou=masterModifyDN,o=example',
'newRDN' : 'uid=newUser.0',
'deleteOldRDN' : True,
}
</call>
<call function="'ldapsearchVerifyFrac'">
{ 'servers' : Pservers,
'keptAttributes' : keptAttributes
}
</call>
<!-- modify the RDN and keep old one -->
<call function="'modifyDn'">
{ 'location' : Pservers[0].getHostname(),
'dsPath' : '%s/%s' % (Pservers[0].getDir(),OPENDSNAME),
'dsInstanceHost' : Pservers[0].getHostname(),
'dsInstancePort' : Pservers[0].getPort(),
'dsInstanceDn' : Pservers[0].getRootDn(),
'dsInstancePswd' : Pservers[0].getRootPwd(),
'DNToModify' : 'uid=user.1,ou=A,ou=masterModifyDN,o=example',
'newRDN' : 'uid=newUser.1',
'deleteOldRDN' : False,
}
</call>
<call function="'ldapsearchVerifyFrac'">
{ 'servers' : Pservers,
'keptAttributes' : keptAttributes
}
</call>
<!-- change superior -->
<call function="'modifyDn'">
{ 'location' : Pservers[0].getHostname(),
'dsPath' : '%s/%s' % (Pservers[0].getDir(),OPENDSNAME),
'dsInstanceHost' : Pservers[0].getHostname(),
'dsInstancePort' : Pservers[0].getPort(),
'dsInstanceDn' : Pservers[0].getRootDn(),
'dsInstancePswd' : Pservers[0].getRootPwd(),
'DNToModify' : 'uid=user.2,ou=A,ou=masterModifyDN,o=example',
'newRDN' : 'uid=newUser.2',
'deleteOldRDN' : False,
'newSuperior' : 'ou=B,ou=masterModifyDN,o=example',
}
</call>
<call function="'ldapsearchVerifyFrac'">
{ 'servers' : Pservers,
'keptAttributes' : keptAttributes
}
</call>
<call function="'SearchObject'">
{ 'location' : Pservers[0].getHostname(),
'dsPath' : '%s/%s' % (Pservers[0].getDir(),OPENDSNAME),
'dsInstanceHost' : Pservers[0].getHostname(),
'dsInstancePort' : Pservers[0].getPort(),
'dsInstanceDn' : Pservers[0].getRootDn(),
'dsInstancePswd' : Pservers[0].getRootPwd(),
'dsBaseDN' : 'ou=masterModifyDN,o=example',
'dsFilter' : 'objectclass=*',
'extraParams' : '-s sub' }
</call>
<message level="'debug'">
STAXResult
</message>
<if expr="RC == 0">
<call function="'testPassed'"/>
<else>
<call function="'testFailed'"/>
</else>
</if>
</sequence>
<catch exception="'STAXException.*'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<sequence>
<call function="'DeleteEntry'">
{ 'location' : Pservers[1].getHostname(),
'dsPath' : '%s/%s' % (Pservers[1].getDir(),OPENDSNAME),
'dsInstanceHost' : Pservers[1].getHostname(),
'dsInstancePort' : Pservers[1].getPort(),
'dsInstanceDn' : Pservers[1].getRootDn(),
'dsInstancePswd' : Pservers[1].getRootPwd(),
'dsBaseDN' : 'ou=masterModifyDN,o=example',
'extraParams' : '-x'
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</finally>
</try>
</testcase>
</function>
</stax>