From 2aa8aee407d3ba221e1fd24e143b916b2d0be3c0 Mon Sep 17 00:00:00 2001
From: Gary Williams <gary.williams@forgerock.com>
Date: Wed, 28 Mar 2012 14:02:43 +0000
Subject: [PATCH] refactor replication functional tests to be one test per function
---
opends/tests/staf-tests/functional-tests/testcases/replication/schema/schema.xml | 1141 ++++++--------------------------------------------------
1 files changed, 122 insertions(+), 1,019 deletions(-)
diff --git a/opends/tests/staf-tests/functional-tests/testcases/replication/schema/schema.xml b/opends/tests/staf-tests/functional-tests/testcases/replication/schema/schema.xml
index 5277922..4063ffc 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/replication/schema/schema.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/replication/schema/schema.xml
@@ -7,1050 +7,153 @@
! 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.
+ ! trunk/opends/resource/legal-notices/CDDLv1_0.txt
+ ! or http://forgerock.org/license/CDDLv1.0.html.
! 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,
+ ! trunk/opends/resource/legal-notices/CDDLv1_0.txt. 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 2007-2008 Sun Microsystems, Inc.
- ! Portions Copyright 2011-2012 ForgeRock AS.
+ ! Copyright 2012 ForgeRock AS.
! -->
<stax>
-
<defaultcall function="replication_schema"/>
-
- <function name="replication_schema">
-
+ <function name="replication_schema" scope="local">
<sequence>
+ <block name="'replication_schema'">
+ <try>
+ <sequence>
+ <script>
+ CurrentTestPath['group'] = 'replication'
+ CurrentTestPath['suite'] = 'schema'
+
+ _group=CurrentTestPath['group']
+ _groupdir='%s/testcases/%s' % (TESTS_DIR,_group)
+ _label = 'Replication Schema'
+ </script>
- <block name="'schema'">
+ <!--- Test Suite information
+ #@TestSuiteName Replication Schema Tests
+ #@TestSuitePurpose Verify that the total-update operations are replicated
+ correctly between two servers.
+ #@TestSuiteID Schema Tests
+ #@TestSuiteGroup Schema
+ #@TestGroup Replication
+ #@TestScript replication_schema.xml
+ #@TestHTMLLink http://www.forgerock.org/
+ -->
+
+ <call function="'testSuite_Preamble'"/>
- <sequence>
-
- <script>
- if not CurrentTestPath.has_key('group'):
- CurrentTestPath['group']='replication'
- CurrentTestPath['suite']=STAXCurrentBlock
- </script>
-
- <call function="'testSuite_Preamble'"/>
-
- <!--- Test Suite information
- #@TestSuiteName Replication Schema Replication Tests
- #@TestSuitePurpose Verify that the schema is replicated as any
- other suffix in a replicated topology.
- #@TestSuiteID Schema Replication Tests
- #@TestSuiteGroup Schema Replication
- #@TestGroup Replication
- #@TestScript replication_schema.xml
- #@TestHTMLLink http://opends.dev.java.net/
- -->
-
+ <try>
+ <sequence>
- <import machine="STAF_LOCAL_HOSTNAME"
- file="'%s/testcases/replication/replication_setup.xml' % TESTS_DIR"/>
- <call function="'replication_setup'" >
- { 'label' : 'Replication Schema' }
- </call>
-
- <script>
- synchroSuffix = master.getSynchronizedSuffixList()[0].getSuffixDn()
-
- currentSchemaFile = '%s/config/schema/99-user.ldif' % masterPath
- provSchemaFile = '%s/../last-99-user.ldif' % masterPath
-
- consumer = consumerList[0]
- consumerHost = consumer.getHostname()
-
- msg1 = 'Replication: Schema:'
- </script>
-
-
- <!--- Test Case information
- #@TestMarker Replication Schema Replication Tests
- #@TestName Replication: Schema Replication: Add objectclass
- #@TestID Add objectclass
- #@TestPurpose Check schema replication when a new objectclass
- is added
- #@TestPreamble Load entries
- #@TestSteps Add new objectclass definition on server1
- #@TestSteps Add entry of new objectclass on server2
- #@TestPostamble
- #@TestResult Success if schema add and entry add replicated
- -->
- <testcase name="getTestCaseName('Add objectclass')">
- <sequence>
- <call function="'testCase_Preamble'"/>
-
- <message>
- 'Test Name = %s' % STAXCurrentTestcase
- </message>
+ <import machine="STAF_LOCAL_HOSTNAME"
+ file="'%s/testcases/replication/replication_setup.xml'
+ % (TESTS_DIR)"/>
+ <call function="'replication_setup'" >
+ { 'label' : _label }
+ </call>
- <message>
- '%s Add objectclass. Check schema replication when a new objectclass is added' % msg1
- </message>
+ <!-- List of Import of Test Functions -->
+ <script>
+ importList=[]
+ importList.append('schema/schema_tests')
+ </script>
- <call function="'testStep'">
- { 'stepMessage' : '%s Load entries into "master" server.' % msg1 }
- </call>
-
- <!-- Load entries into "master" server -->
- <call function="'addEntry'">
- { 'location' : clientHost,
- 'dsPath' : clientPath,
- 'dsInstanceHost' : masterHost,
- 'dsInstancePort' : master.getPort(),
- 'dsInstanceDn' : master.getRootDn(),
- 'dsInstancePswd' : master.getRootPwd(),
- 'entryToBeAdded' : '%s/replication/Example.ldif' % \
- clientDataDir
- }
- </call>
+ <!-- Import the files for this test suite -->
+ <iterate var="_import" in="importList">
+ <import machine="STAF_LOCAL_HOSTNAME"
+ file="'%s/%s.xml' % (_groupdir,_import)"/>
+ </iterate>
- <call function="'testStep'">
- { 'stepMessage' : '%s Add new object class.' % msg1 }
- </call>
-
- <script>
- newObjectclass = '( testobjectclass-oid NAME \'testobjectclass-0\' SUP person MAY ( street $ c ) X-ORIGIN \'user defined\' )'
- </script>
-
- <!-- Modify schema in "master" server -->
- <call function="'modifyAnAttribute'">
- { 'dsPath' : masterPath,
- 'dsInstanceHost' : masterHost ,
- 'dsInstancePort' : master.getPort(),
- 'dsInstanceDn' : master.getRootDn(),
- 'dsInstancePswd' : master.getRootPwd(),
- 'DNToModify' : 'cn=schema',
- 'attributeName' : 'objectClasses',
- 'newAttributeValue' : newObjectclass,
- 'changetype' : 'add'
- }
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Add entry to "consumer" server using new objectclass.' % msg1 }
- </call>
-
- <!-- Add entry to "consumer" server -->
- <call function="'addEntry'">
- { 'location' : clientHost,
- 'dsPath' : clientPath,
- 'dsInstanceHost' : consumerHost,
- 'dsInstancePort' : consumer.getPort(),
- 'dsInstanceDn' : consumer.getRootDn(),
- 'dsInstancePswd' : consumer.getRootPwd(),
- 'entryToBeAdded' : '%s/replication/testuser-0.ldif' % \
- clientDataDir
- }
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Verify the synchronization of the schema on all the servers.' % msg1 }
- </call>
-
- <!-- Verify the synchronization of the schema among the servers
- in the topology -->
- <call function="'verifySchemas'">
- [ clientHost, clientPath, master, consumerList, '99-user.ldif' ]
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Verify the synchronization of the trees on all the servers.' % msg1 }
- </call>
-
- <!-- Verify the synchronization of the trees among the servers in
- the topology -->
- <call function="'verifyTrees'">
- [ clientHost, clientPath, master, consumerList, synchroSuffix ]
- </call>
-
- <call function="'testCase_Postamble'"/>
- </sequence>
- </testcase>
-
-
-
-
- <!--- Test Case information
- #@TestMarker Replication Schema Replication Tests
- #@TestName Replication: Schema Replication:
- Add attributetype
- #@TestID Add attributetype
- #@TestPurpose Check schema replication when a new
- attributetype is added
- #@TestPreamble
- #@TestSteps Add new attributeType and new objectclass
- definition on server1
- #@TestSteps Add new entry containing new objectclass and
- new attributeType on server2
- #@TestPostamble
- #@TestResult Success if schema add and entry adds replicated
- -->
- <testcase name="getTestCaseName('Add attributetype')">
- <sequence>
- <call function="'testCase_Preamble'"/>
-
- <message>
- '%s Add Attributetype. schema replication when a new Attributetype is added' % msg1
- </message>
-
- <script>
- newObjectclass = '( testobjectclass1-oid NAME \'testobjectclass-1\' SUP person MAY ( street $ testattribute-1 $ c ) X-ORIGIN \'user defined\' )'
- newAttributetype = '( testattribute1-oid NAME \'testattribute-1\' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN \'user defined\' )'
- </script>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Add newAttributetype in "master" server.' % msg1 }
- </call>
-
- <!-- Modify schema in "master" server -->
- <call function="'modifyAnAttribute'">
- { 'dsPath' : masterPath,
- 'dsInstanceHost' : masterHost ,
- 'dsInstancePort' : master.getPort(),
- 'dsInstanceDn' : master.getRootDn(),
- 'dsInstancePswd' : master.getRootPwd(),
- 'DNToModify' : 'cn=schema',
- 'attributeName' : 'attributeTypes',
- 'newAttributeValue' : newAttributetype,
- 'changetype' : 'add'
- }
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Add newObjectclass in "master" server.' % msg1 }
- </call>
-
- <call function="'modifyAnAttribute'">
- { 'dsPath' : masterPath,
- 'dsInstanceHost' : masterHost ,
- 'dsInstancePort' : master.getPort(),
- 'dsInstanceDn' : master.getRootDn(),
- 'dsInstancePswd' : master.getRootPwd(),
- 'DNToModify' : 'cn=schema',
- 'attributeName' : 'objectClasses',
- 'newAttributeValue' : newObjectclass,
- 'changetype' : 'add'
- }
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Add entry to "consumer" server.' % msg1 }
- </call>
-
- <!-- Add entry to "consumer" server -->
- <call function="'addEntry'">
- { 'location' : clientHost,
- 'dsPath' : clientPath,
- 'dsInstanceHost' : consumerHost,
- 'dsInstancePort' : consumer.getPort(),
- 'dsInstanceDn' : consumer.getRootDn(),
- 'dsInstancePswd' : consumer.getRootPwd(),
- 'entryToBeAdded' : '%s/replication/testuser-1.ldif' % \
- clientDataDir
- }
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Verify the synchronization of the schema on all the servers.' % msg1 }
- </call>
-
- <!-- Verify the synchronization of the schema among the servers in
- the topology -->
- <call function="'verifySchemas'">
- [ clientHost, clientPath, master, consumerList, '99-user.ldif' ]
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Verify the synchronization of the trees on all the servers.' % msg1 }
- </call>
-
- <!-- Verify the synchronization of the trees among the servers in
- the topology -->
- <call function="'verifyTrees'">
- [ clientHost, clientPath, master, consumerList, synchroSuffix ]
- </call>
-
- <call function="'testCase_Postamble'"/>
- </sequence>
- </testcase>
-
-
-
- <!-- Test Case information
- #@TestMarker Replication Schema Replication Tests
- #@TestName Replication: Schema Replication:
- Delete objectclass
- #@TestID Delete objectclass
- #@TestPurpose Check schema replication when an objectclass
- is deleted
- #@TestPreamble
- #@TestSteps Remove user-defined objectclass definition on
- server1
- #@TestSteps Delete entry on server1
- #@TestSteps Add entry containing removed objectclass on
- every server
- #@TestPostamble
- #@TestResult Success if schema remove replicated and last
- entry add rejected on all servers (error 65:
- objectclass violation)
- -->
- <testcase name="getTestCaseName('Delete objectclass')">
- <sequence>
- <call function="'testCase_Preamble'"/>
-
- <message>
- 'Test Name = %s' % STAXCurrentTestcase
- </message>
-
- <message>
- '%s Delete objectclass. Check schema replication when an objectclass is deleted' % msg1
- </message>
-
- <script>
- newObjectclass = '( testobjectclass-oid NAME \'testobjectclass-0\' SUP person MAY ( street $ c ) X-ORIGIN \'user defined\' )'
- </script>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Delete newObjectclass in "master" server.' % msg1 }
- </call>
-
- <!-- Modify schema in "master" server -->
- <call function="'modifyAnAttribute'">
- { 'dsPath' : masterPath,
- 'dsInstanceHost' : masterHost ,
- 'dsInstancePort' : master.getPort(),
- 'dsInstanceDn' : master.getRootDn(),
- 'dsInstancePswd' : master.getRootPwd(),
- 'DNToModify' : 'cn=schema',
- 'attributeName' : 'objectClasses',
- 'newAttributeValue' : newObjectclass,
- 'changetype' : 'delete'
- }
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Delete previously added entry.' % msg1 }
- </call>
-
- <!-- Delete previously added entry -->
- <call function="'ldapDeleteWithScript'">
- { 'location' : clientHost,
- 'dsPath' : clientPath,
- 'dsInstanceHost' : master.getHostname(),
- 'dsInstancePort' : master.getPort(),
- 'dsInstanceDn' : master.getRootDn(),
- 'dsInstancePswd' : master.getRootPwd(),
- 'dsDn' : ['cn=testuser-0,ou=People,%s' % synchroSuffix]
- }
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Attempt to add entry to servers with deleted objectclass.' % msg1 }
- </call>
-
- <!-- Try to add entry to servers; should be rejected with error 65
- (objectclass violation) -->
- <iterate var="server" in="_topologyServerList">
- <call function="'addEntry'">
- { 'location' : clientHost,
- 'dsPath' : clientPath,
- 'dsInstanceHost' : server.getHostname(),
- 'dsInstancePort' : server.getPort(),
- 'dsInstanceDn' : server.getRootDn(),
- 'dsInstancePswd' : server.getRootPwd(),
- 'entryToBeAdded' : '%s/replication/testuser-0.ldif' % \
- clientDataDir,
- 'expectedRC' : 65
- }
- </call>
- </iterate>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Verify the synchronization of the schema on all the servers.' % msg1 }
- </call>
-
- <!-- Verify the synchronization of the schema among the servers in
- the topology -->
- <call function="'verifySchemas'">
- [ clientHost, clientPath, master, consumerList, '99-user.ldif' ]
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Verify the synchronization of the trees on all the servers.' % msg1 }
- </call>
-
- <!-- Verify the synchronization of the trees among the servers in
- the topology -->
- <call function="'verifyTrees'">
- [ clientHost, clientPath, master, consumerList, synchroSuffix ]
- </call>
-
- <call function="'testCase_Postamble'"/>
- </sequence>
- </testcase>
-
-
-
- <!-- Test Case information
- #@TestMarker Replication Schema Replication Tests
- #@TestName Replication: Schema Replication:
- Modify objectclass
- #@TestID Modify objectclass
- #@TestPurpose Check schema replication when an objectclass is
- modified
- #@TestPreamble
- #@TestSteps Remove user-defined objectclass definition on
- server1
- #@TestSteps Add modified version of removed user-defined
- objectclass on server1 (make attributes
- MANDATORY)
- #@TestSteps Add entry containing newly added objectclass but
- without required attributes on every server
- #@TestPostamble
- #@TestResult Success if schema modify replicated and entry
- add rejected with error 65 (objectclass
- violation) on all servers
- -->
- <testcase name="getTestCaseName('Modify objectclass')">
- <sequence>
- <call function="'testCase_Preamble'"/>
-
- <message>
- 'Test Name = %s' % STAXCurrentTestcase
- </message>
-
- <message>
- '%s Modify objectclass. Check schema replication when an objectclass is modified' % msg1
- </message>
-
- <script>
- oldObjectclass = '( testobjectclass1-oid NAME \'testobjectclass-1\' SUP person MAY ( street $ testattribute-1 $ c ) X-ORIGIN \'user defined\' )'
- newObjectclass = '( testobjectclass1-oid NAME \'testobjectclass-1\' SUP person MUST ( street $ testattribute-1 $ c ) X-ORIGIN \'user defined\' )'
- </script>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Delete oldObjectclass in "master" server.' % msg1 }
- </call>
-
- <!-- Modify schema in "master" server -->
- <call function="'modifyAnAttribute'">
- { 'dsPath' : masterPath,
- 'dsInstanceHost' : masterHost ,
- 'dsInstancePort' : master.getPort(),
- 'dsInstanceDn' : master.getRootDn(),
- 'dsInstancePswd' : master.getRootPwd(),
- 'DNToModify' : 'cn=schema',
- 'attributeName' : 'objectClasses',
- 'newAttributeValue' : oldObjectclass,
- 'changetype' : 'delete'
- }
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Add newObjectclass in "master" server.' % msg1 }
- </call>
-
- <call function="'modifyAnAttribute'">
- { 'dsPath' : masterPath,
- 'dsInstanceHost' : masterHost ,
- 'dsInstancePort' : master.getPort(),
- 'dsInstanceDn' : master.getRootDn(),
- 'dsInstancePswd' : master.getRootPwd(),
- 'DNToModify' : 'cn=schema',
- 'attributeName' : 'objectClasses',
- 'newAttributeValue' : newObjectclass,
- 'changetype' : 'add'
- }
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Attempt to add entry to servers with deleted objectclass.' % msg1 }
- </call>
-
- <!-- Try to add entry to servers; should be rejected with error 65
- (objectclass violation) -->
- <iterate var="server" in="_topologyServerList">
- <call function="'addEntry'">
- { 'location' : clientHost,
- 'dsPath' : clientPath,
- 'dsInstanceHost' : server.getHostname(),
- 'dsInstancePort' : server.getPort(),
- 'dsInstanceDn' : server.getRootDn(),
- 'dsInstancePswd' : server.getRootPwd(),
- 'entryToBeAdded' : '%s/replication/testuser-2.ldif' % \
- clientDataDir,
- 'expectedRC' : 65
- }
- </call>
- </iterate>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Verify the synchronization of the schema on all the servers.' % msg1 }
- </call>
-
- <!-- Verify the synchronization of the schema among the servers in
- the topology -->
- <call function="'verifySchemas'">
- [ clientHost, clientPath, master, consumerList, '99-user.ldif' ]
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Verify the synchronization of the trees on all the servers.' % msg1 }
- </call>
-
- <!-- Verify the synchronization of the trees among the servers in
- the topology -->
- <call function="'verifyTrees'">
- [ clientHost, clientPath, master, consumerList, synchroSuffix ]
- </call>
-
- <call function="'testCase_Postamble'"/>
- </sequence>
- </testcase>
-
-
-
- <!--- Test Case information
- #@TestMarker Replication Schema Replication Tests
- #@TestName Replication: Schema Replication: Add objectclass
- (edit schema file)
- #@TestID Add objectclass (edit schema file)
- #@TestPurpose Check schema replication when a new objectclass
- is added manually
- #@TestPreamble
- #@TestSteps Stop servers
- #@TestSteps Edit 99-user.ldif to add new objectclass
- definition on server1
- #@TestSteps Start servers
- #@TestSteps Add entry of new objectclass on server2
- #@TestPostamble
- #@TestResult Success if schema add and entry add replicated
- -->
- <testcase name="getTestCaseName
- ('Add objectclass (edit schema file)')">
- <sequence>
- <call function="'testCase_Preamble'"/>
-
- <message>
- 'Test Name = %s' % STAXCurrentTestcase
- </message>
-
- <message>
- '%s Add objectclass. (edit schema file). \
- Check schema replication when a new objectclass \
- is added manually ' % msg1
- </message>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Stop the servers in the topology.' % msg1 }
- </call>
-
- <!-- Stop the servers in the topology -->
- <call function="'stopServers'">
- [_topologyServerList]
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Modify schema in "master" server.' % msg1 }
- </call>
-
- <!-- Modify schema in "master" server -->
- <call function="'copyFile'">
- { 'location' : masterHost,
- 'remotehost' : masterHost,
- 'srcfile' : currentSchemaFile,
- 'destfile' : provSchemaFile
- }
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Edit schema file.' % msg1 }
- </call>
-
- <call function="'LdifModifyWithScript'">
- { 'location' : masterHost,
- 'dsPath' : masterPath,
- 'sourceLdif' : provSchemaFile,
- 'changesLdif' : '%s/replication/schemamods-0.ldif' % \
- masterDataDir,
- 'targetLdif' : currentSchemaFile
- }
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Stop the servers in the topology.' % msg1 }
- </call>
-
- <!-- Start the servers in the topology -->
- <call function="'startServers'">
- [_topologyServerList]
- </call>
-
- <call function="'Sleep'">
- { 'sleepForMilliSeconds' : 1000 }
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Add entry to "consumer" server.' % msg1 }
- </call>
-
- <!-- Add entry to "consumer" server -->
- <call function="'addEntry'">
- { 'location' : clientHost,
- 'dsPath' : clientPath,
- 'dsInstanceHost' : consumerHost,
- 'dsInstancePort' : consumer.getPort(),
- 'dsInstanceDn' : consumer.getRootDn(),
- 'dsInstancePswd' : consumer.getRootPwd(),
- 'entryToBeAdded' : '%s/replication/newtestuser-0.ldif' % \
- clientDataDir,
- 'knownIssue' : 'OPENDJ-452'
- }
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Verify the synchronization of the schema on all the servers.' % msg1 }
- </call>
-
- <!-- Verify the synchronization of the schema among the servers in
- the topology -->
- <call function="'verifySchemas'">
- [ clientHost, clientPath, master, consumerList, '99-user.ldif' ]
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Verify the synchronization of the trees on all the servers.' % msg1 }
- </call>
-
- <!-- Verify the synchronization of the trees among the servers in
- the topology -->
- <call function="'verifyTrees'">
- [ clientHost, clientPath, master, consumerList, synchroSuffix ]
- </call>
-
- <call function="'testCase_Postamble'"/>
- </sequence>
- </testcase>
-
-
-
-
- <!--- Test Case information
- #@TestMarker Replication Schema Replication Tests
- #@TestName Replication: Schema Replication: Add
- attributetype (edit schema file)
- #@TestID Add attributetype (edit schema file)
- #@TestPurpose Check schema replication when a new
- attributetype is added manually
- #@TestPreamble
- #@TestSteps Stop servers
- #@TestSteps Edit 99-user.ldif to add new objectclass and
- new attributeType definition on server1
- #@TestSteps Start servers
- #@TestSteps Add new entry containing new objectclass and
- new attributeType on server2
- #@TestPostamble
- #@TestResult Success if schema add and entry adds replicated
- -->
- <testcase name="getTestCaseName
- ('Add attributetype (edit schema file)')">
- <sequence>
- <call function="'testCase_Preamble'"/>
- <message>
- 'Replication: Schema Replication: Add attributetype (edit \
- schema file). Check schema replication when a new \
- attributetype is added manually'
- </message>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Stop the servers in the topology.' % msg1 }
- </call>
-
- <!-- Stop the servers in the topology -->
- <call function="'stopServers'">
- [_topologyServerList]
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Modify schema in "master" server .' % msg1 }
- </call>
-
- <!-- Modify schema in "master" server -->
- <call function="'copyFile'">
- { 'location' : masterHost,
- 'remotehost' : masterHost,
- 'srcfile' : currentSchemaFile,
- 'destfile' : provSchemaFile
- }
- </call>
- <call function="'LdifModifyWithScript'">
- { 'location' : masterHost,
- 'dsPath' : masterPath,
- 'sourceLdif' : provSchemaFile,
- 'changesLdif' : '%s/replication/schemamods-1.ldif' % \
- masterDataDir,
- 'targetLdif' : currentSchemaFile
- }
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Start the servers in the topology.' % msg1 }
- </call>
-
- <!-- Start the servers in the topology -->
- <call function="'startServers'">
- [_topologyServerList]
- </call>
-
- <call function="'Sleep'">
- { 'sleepForMilliSeconds' : 1000 }
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Add entry to "consumer" server.' % msg1 }
- </call>
-
- <!-- Add entry to "consumer" server -->
- <call function="'addEntry'">
- { 'location' : clientHost,
- 'dsPath' : clientPath,
- 'dsInstanceHost' : consumerHost,
- 'dsInstancePort' : consumer.getPort(),
- 'dsInstanceDn' : consumer.getRootDn(),
- 'dsInstancePswd' : consumer.getRootPwd(),
- 'entryToBeAdded' : '%s/replication/newtestuser-1.ldif' % \
- clientDataDir,
- 'knownIssue' : 'OPENDJ-452'
- }
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Verify the synchronization of the schema on all the servers.' % msg1 }
- </call>
-
- <!-- Verify the synchronization of the schema among the servers in
- the topology -->
- <call function="'verifySchemas'">
- [ clientHost, clientPath, master, consumerList, '99-user.ldif' ]
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Verify the synchronization of the trees on all the servers.' % msg1 }
- </call>
-
- <!-- Verify the synchronization of the trees among the servers in
- the topology -->
- <call function="'verifyTrees'">
- [ clientHost, clientPath, master, consumerList, synchroSuffix ]
- </call>
-
- <call function="'testCase_Postamble'"/>
- </sequence>
- </testcase>
-
-
-
-
- <!-- Test Case information
- #@TestMarker Replication Schema Replication Tests
- #@TestName Replication: Schema Replication: Delete
- objectclass (edit schema file)
- #@TestID Delete objectclass (edit schema file)
- #@TestPurpose Check schema replication when an objectclass is
- deleted manually
- #@TestPreamble
- #@TestSteps Stop servers
- #@TestSteps Edit 99-user.ldif to remove user-defined
- objectclass definition on server1
- #@TestSteps Start servers
- #@TestSteps Delete entry on server1
- #@TestSteps Add entry containing removed objectclass on
- every server
- #@TestPostamble
- #@TestResult Success if schema remove replicated and last
- entry add rejected on all servers (error 65:
- objectclass violation)
- -->
- <testcase name="getTestCaseName
- ('Delete objectclass (edit schema file)')">
- <sequence>
- <call function="'testCase_Preamble'"/>
- <message>
- 'Replication: Schema Replication: Delete objectclass (edit \
- schema file). Check schema replication when an objectclass is \
- deleted manually'
- </message>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Stop the servers in the topology.' % msg1 }
- </call>
-
- <!-- Stop the servers in the topology -->
- <call function="'stopServers'">
- [_topologyServerList]
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Modify schema in "master" server.' % msg1 }
- </call>
-
- <!-- Modify schema in "master" server -->
- <call function="'copyFile'">
- { 'location' : masterHost,
- 'remotehost' : masterHost,
- 'srcfile' : currentSchemaFile,
- 'destfile' : provSchemaFile
- }
- </call>
- <call function="'LdifModifyWithScript'">
- { 'location' : masterHost,
- 'dsPath' : masterPath,
- 'sourceLdif' : provSchemaFile,
- 'changesLdif' : '%s/replication/schemamods-2.ldif' % \
- masterDataDir,
- 'targetLdif' : currentSchemaFile
- }
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Start the servers in the topology.' % msg1 }
- </call>
-
- <!-- Start the servers in the topology -->
- <call function="'startServers'">
- [_topologyServerList]
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Delete previously added entry.' % msg1 }
- </call>
-
- <!-- Delete previously added entry -->
- <call function="'ldapDeleteWithScript'">
- { 'location' : clientHost,
- 'dsPath' : clientPath,
- 'dsInstanceHost' : master.getHostname(),
- 'dsInstancePort' : master.getPort(),
- 'dsInstanceDn' : master.getRootDn(),
- 'dsInstancePswd' : master.getRootPwd(),
- 'dsDn' : ['cn=newtestuser-0,ou=People,%s' % synchroSuffix],
- 'knownIssue' : 'OPENDJ-452'
+ <!-- Specific to replication tests -->
+ <script>
+ msg1 = 'Replication: Schema:'
+ synchroSuffix = master.getSynchronizedSuffixList()[0].getSuffixDn()
-
- }
- </call>
-
- <call function="'Sleep'">
- { 'sleepForMilliSeconds' : 1000 }
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Try to add entry to servers.' % msg1 }
- </call>
-
- <!-- Try to add entry to servers; should be rejected with error 65
- (objectclass violation) -->
- <!-- If the add doesn't return 65, it may mean we came across
- issue OPENDJ-453 (Manual schema objectclass delete not replicated) -->
- <iterate var="server" in="_topologyServerList">
- <call function="'addEntry'">
- { 'location' : clientHost,
- 'dsPath' : clientPath,
- 'dsInstanceHost' : server.getHostname(),
- 'dsInstancePort' : server.getPort(),
- 'dsInstanceDn' : server.getRootDn(),
- 'dsInstancePswd' : server.getRootPwd(),
- 'entryToBeAdded' : '%s/replication/newtestuser-0.ldif' % \
- clientDataDir,
- 'expectedRC' : 65,
- 'knownIssue' : 'OPENDJ-453'
- }
- </call>
- </iterate>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Verify the synchronization of the schema on all the servers.' % msg1 }
- </call>
-
- <!-- Verify the synchronization of the schema among the servers in
- the topology -->
- <call function="'verifySchemas'">
- [ clientHost, clientPath, master, consumerList, '99-user.ldif' ]
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Verify the synchronization of the trees on all the servers.' % msg1 }
- </call>
-
- <!-- Verify the synchronization of the trees among the servers in
- the topology -->
- <call function="'verifyTrees'">
- [ clientHost, clientPath, master, consumerList, synchroSuffix ]
- </call>
-
-
- <call function="'testCase_Postamble'"/>
- </sequence>
- </testcase>
-
-
-
- <!-- Test Case information
- #@TestMarker Replication Schema Replication Tests
- #@TestName Replication: Schema Replication: Modify
- objectclass (edit schema file)
- #@TestID Modify objectclass (edit schema file)
- #@TestPurpose Check schema replication when an objectclass is
- modified manually
- #@TestPreamble
- #@TestSteps Stop servers
- #@TestSteps Edit 99-user.ldif to modify user-defined
- objectclass (make attributes MANDATORY) on
- server1
- #@TestSteps Start servers
- #@TestSteps Add entry containing newly added objectclass but
- without required attributes on every server
- #@TestPostamble
- #@TestResult Success if schema modify replicated and entry
- add rejected with error 65 (objectclass
- violation) on all servers
- -->
- <testcase name="getTestCaseName
- ('Modify objectclass (edit schema file)')">
- <sequence>
- <call function="'testCase_Preamble'"/>
- <message>
- 'Replication: Schema Replication: Modify objectclass (edit \
- schema file). Check schema replication when an objectclass is \
- modified manually'
- </message>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Stop the servers in the topology.' % msg1 }
- </call>
-
- <!-- Stop the servers in the topology -->
- <call function="'stopServers'">
- [_topologyServerList]
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Modify schema in "master" server.' % msg1 }
- </call>
-
- <!-- Modify schema in "master" server -->
- <call function="'copyFile'">
- { 'location' : masterHost,
- 'remotehost' : masterHost,
- 'srcfile' : currentSchemaFile,
- 'destfile' : provSchemaFile
- }
- </call>
- <call function="'LdifModifyWithScript'">
- { 'location' : masterHost,
- 'dsPath' : masterPath,
- 'sourceLdif' : provSchemaFile,
- 'changesLdif' : '%s/replication/schemamods-3.ldif' % \
- masterDataDir,
- 'targetLdif' : currentSchemaFile
- }
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Start the servers in the topology.' % msg1 }
- </call>
-
- <!-- Start the servers in the topology -->
- <call function="'startServers'">
- [_topologyServerList]
- </call>
-
- <call function="'Sleep'">
- { 'sleepForMilliSeconds' : 1000 }
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Try to add entry to servers.' % msg1 }
- </call>
-
- <!-- Try to add entry to servers; should be rejected with error 65
- (objectclass violation) -->
- <!-- If the add doesn't return 65, it may mean we came across
- issue OPENDJ-453 (Manual schema objectclass delete not replicated) -->
- <iterate var="server" in="_topologyServerList">
- <call function="'addEntry'">
- { 'location' : clientHost,
- 'dsPath' : clientPath,
- 'dsInstanceHost' : server.getHostname(),
- 'dsInstancePort' : server.getPort(),
- 'dsInstanceDn' : server.getRootDn(),
- 'dsInstancePswd' : server.getRootPwd(),
- 'entryToBeAdded' : '%s/replication/newtestuser-2.ldif' % \
- clientDataDir,
- 'expectedRC' : 65,
- 'knownIssue' : ['OPENDJ-453','OPENDJ-452']
- }
- </call>
- </iterate>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Verify the synchronization of the schema on all the servers.' % msg1 }
- </call>
-
- <!-- Verify the synchronization of the schema among the servers in
- the topology -->
- <!-- Since this testcase inherits the 99-user.ldif from the one
- before, as long as OPENDJ-453 is still present, the schema files will
- differ as the second server will still have newobjectclass-0 -->
- <call function="'verifySchemas'">
- [ clientHost, clientPath, master, consumerList, '99-user.ldif',
- 'OPENDJ-453' ]
- </call>
-
- <call function="'testStep'">
- { 'stepMessage' : '%s Verify the synchronization of the trees on all the servers.' % msg1 }
- </call>
-
- <!-- Verify the synchronization of the trees among the servers in
- the topology -->
- <call function="'verifyTrees'">
- [ clientHost, clientPath, master, consumerList, synchroSuffix ]
- </call>
-
-
- <call function="'testCase_Postamble'"/>
- </sequence>
- </testcase>
-
-
- <import machine="STAF_LOCAL_HOSTNAME"
- file="'%s/testcases/replication/replication_cleanup.xml' % TESTS_DIR"/>
- <call function="'replication_cleanup'" >
- { 'label' : 'Replication Schema' }
- </call>
-
- <call function="'testSuite_Postamble'"/>
+ currentSchemaFile = '%s/config/schema/99-user.ldif' % masterPath
+ provSchemaFile = '%s/../last-99-user.ldif' % masterPath
- </sequence>
+ consumer = consumerList[0]
+ consumerHost = consumer.getHostname()
+ </script>
+
+ <!-- List of Test Cases -->
+ <script>
+ testsList=[]
+ testsList.append('replication_schema_001')
+ testsList.append('replication_schema_002')
+ testsList.append('replication_schema_003')
+ testsList.append('replication_schema_004')
+ testsList.append('replication_schema_005')
+ testsList.append('replication_schema_006')
+ testsList.append('replication_schema_007')
+ testsList.append('replication_schema_008')
+ </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: Replication Cleanup.'</message>
+ <try>
+ <sequence>
+ <import machine="STAF_LOCAL_HOSTNAME"
+ file="'%s/testcases/replication/replication_cleanup.xml'
+ % (TESTS_DIR)"/>
+ <call function="'replication_cleanup'">
+ { 'label' : _label }
+ </call>
+ </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>
-
</stax>
--
Gitblit v1.10.0