From b61d5999b3e9eb0c0d2cb760bffa46e5aac37256 Mon Sep 17 00:00:00 2001
From: ugaston <ugaston@localhost>
Date: Thu, 29 Nov 2007 19:07:40 +0000
Subject: [PATCH] Replication tests: fixes, enhancements + new encryption testsuite
---
opendj-sdk/opends/tests/shared/functions/utils.xml | 26 +
opendj-sdk/opends/tests/functional-tests/testcases/replication/replication.xml | 9
opendj-sdk/opends/tests/functional-tests/testcases/replication/encryption/encryption.xml | 900 ++++++++++++++++++++++++++++++++++++++++++++++++++
opendj-sdk/opends/tests/functional-tests/testcases/replication/replication_setup.xml | 23 +
opendj-sdk/opends/tests/functional-tests/testcases/replication/failover/failover.xml | 3
opendj-sdk/opends/tests/functional-tests/testcases/replication/totalupdate/totalupdate.xml | 109 ++++-
6 files changed, 1,037 insertions(+), 33 deletions(-)
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/replication/encryption/encryption.xml b/opendj-sdk/opends/tests/functional-tests/testcases/replication/encryption/encryption.xml
new file mode 100644
index 0000000..f197925
--- /dev/null
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/replication/encryption/encryption.xml
@@ -0,0 +1,900 @@
+<?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
+ !
+ ! Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ ! -->
+<stax>
+
+ <defaultcall function="replication_encryption"/>
+
+ <function name="replication_encryption">
+
+ <sequence>
+
+ <block name="'encryption'">
+
+ <sequence>
+
+ <script>
+ if not CurrentTestPath.has_key('group'):
+ CurrentTestPath['group']='replication'
+ CurrentTestPath['suite']=STAXCurrentBlock
+ </script>
+
+ <call function="'testSuite_Preamble'"/>
+
+ <!--- Test Suite information
+ #@TestSuiteName Replication Encryption Tests
+ #@TestSuitePurpose Verify that replication can use an encrypted
+ channel.
+ #@TestSuiteID Encryption Tests
+ #@TestSuiteGroup Encryption
+ #@TestGroup Replication
+ #@TestScript replication_encryption.xml
+ #@TestHTMLLink http://opends.dev.java.net/
+ -->
+
+
+ <import machine="STAF_LOCAL_HOSTNAME"
+ file="'%s/testcases/replication/replication_setup.xml'
+ % (TESTS_DIR)"/>
+ <call function="'replication_setup'">
+ { 'topologyFile' : '%s/config/replication/3server_topology.txt' \
+ % TESTS_DIR,
+ 'secureReplication' : True }
+ </call>
+
+ <script>
+ consumer = consumerList[0]
+ synchroSuffix = master.getSynchronizedSuffixList()[0].getSuffixDn()
+ </script>
+
+
+ <!-- Load entries into "master" server -->
+ <!-- Stop "master" Directory Server -->
+ <call function="'StopDsWithScript'">
+ { 'location' : masterHost,
+ 'dsPath' : masterPath,
+ 'dsHost' : masterHost,
+ 'dsPort' : master.getPort(),
+ 'dsBindDN' : master.getRootDn(),
+ 'dsBindPwd' : master.getRootPwd()
+ }
+ </call>
+
+ <!-- Import data into "master" Directory Server -->
+ <call function="'ImportLdifWithScript'">
+ { 'location' : masterHost,
+ 'dsPath' : masterPath,
+ 'dsBackEnd' : 'userRoot',
+ 'dsLdifFile' : '%s/replication/Example.ldif' % masterDataDir
+ }
+ </call>
+
+ <!-- Start the Directory Server -->
+ <call function="'StartDsWithScript'">
+ { 'location' : masterHost,
+ 'dsPath' : masterPath
+ }
+ </call>
+
+ <!-- Wait for DS to start -->
+ <call function="'isAlive'">
+ { 'location' : masterHost,
+ 'dsPath' : masterPath,
+ 'dsInstanceHost' : masterHost,
+ 'dsInstancePort' : master.getPort() ,
+ 'dsInstanceDn' : master.getRootDn() ,
+ 'dsInstancePswd' : master.getRootPwd() ,
+ 'noOfLoops' : 10 ,
+ 'noOfMilliSeconds' : 2000
+ }
+ </call>
+
+ <!-- Initialise the servers in the topology -->
+<!--
+ <call function="'initializeReplication'">
+ { 'location' : clientHost,
+ 'dsPath' : clientPath,
+ 'sourceInstanceHost' : masterHost,
+ 'sourceInstancePort' : master.getPort(),
+ 'replicationDnList' : [synchroSuffix]
+ }
+ </call>
+-->
+ <iterate var="server" in="consumerList">
+ <call function="'initializeReplication'">
+ { 'location' : clientHost,
+ 'dsPath' : clientPath,
+ 'dsInstanceHost' : server.getHostname(),
+ 'dsInstancePort' : server.getPort(),
+ 'sourceInstanceHost' : masterHost,
+ 'sourceInstancePort' : master.getPort(),
+ 'replicationDnList' : [synchroSuffix]
+ }
+ </call>
+ </iterate>
+
+
+ <!--- Test Case information
+ #@TestMarker Replication Encryption Tests
+ #@TestName Replication: Encryption: Add entry
+ #@TestID Add entry
+ #@TestPurpose Check entry add over secured replication
+ #@TestPreamble
+ #@TestSteps
+ #@TestPostamble
+ #@TestResult
+ -->
+ <testcase name="getTestCaseName('Add entry')">
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Replication: Encryption: Add entry. Check entry add over \
+ secured replication'
+ </message>
+
+ <iterate var="server" in="_topologyServerList" indexvar="i">
+ <sequence>
+
+ <script>
+ serverPath = '%s/%s' % (server.getDir(), OPENDSNAME)
+ userDn = 'uid=iabizen-%s, ou=People, %s' % (i, synchroSuffix)
+ </script>
+
+ <!-- Add entry to one of the other servers -->
+ <script>
+ listAttr = []
+ listAttr.append('objectclass:top')
+ listAttr.append('objectclass:organizationalperson')
+ listAttr.append('objectclass:inetorgperson')
+ listAttr.append('objectclass:person')
+ listAttr.append('givenname:Izen-%s' % i)
+ listAttr.append('sn:Abizen-%s' % i)
+ listAttr.append('cn:Izen-%s Abizen-%s' % (i, i))
+ listAttr.append('l: ICNC')
+ </script>
+
+ <call function="'addAnEntry'">
+ { 'location' : server.getHostname(),
+ 'dsPath' : serverPath,
+ 'dsInstanceHost' : server.getHostname(),
+ 'dsInstancePort' : server.getPort(),
+ 'dsInstanceDn' : server.getRootDn(),
+ 'dsInstancePswd' : server.getRootPwd(),
+ 'DNToAdd' : userDn,
+ 'listAttributes' : listAttr,
+ 'expectedRC' : 0
+ }
+ </call>
+
+ </sequence>
+ </iterate>
+
+ <!-- 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 Encryption Tests
+ #@TestName Replication: Encryption: Modify entry
+ #@TestID Modify entry
+ #@TestPurpose Check entry modify over secured replication
+ #@TestPreamble
+ #@TestSteps
+ #@TestPostamble
+ #@TestResult
+ -->
+ <testcase name="getTestCaseName('Modify entry')">
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Replication: Encryption: Modify entry. Check entry modify over \
+ secured replication'
+ </message>
+
+ <script>
+ serverPath = '%s/%s' % (server.getDir(), OPENDSNAME)
+ userDn = 'uid=iabizen-1, ou=People, %s' % synchroSuffix
+ </script>
+
+ <!-- Modify entry in "master" server -->
+ <call function="'modifyAnAttribute'">
+ { 'dsPath' : masterPath,
+ 'dsInstanceHost' : masterHost ,
+ 'dsInstancePort' : master.getPort(),
+ 'dsInstanceDn' : master.getRootDn(),
+ 'dsInstancePswd' : master.getRootPwd(),
+ 'DNToModify' : userDn,
+ 'attributeName' : 'l',
+ 'newAttributeValue' : 'GEC',
+ 'changetype' : 'replace' }
+ </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 Encryption Tests
+ #@TestName Replication: Encryption: Delete entry
+ #@TestID Delete entry
+ #@TestPurpose Check entry delete over secured replication
+ #@TestPreamble
+ #@TestSteps
+ #@TestPostamble
+ #@TestResult
+ -->
+ <testcase name="getTestCaseName('Delete entry')">
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Replication: Encryption: Delete entry. Check delete modify over \
+ secured replication'
+ </message>
+
+ <script>
+ serverPath = '%s/%s' % (server.getDir(), OPENDSNAME)
+ userDn = 'uid=iabizen-2, ou=People, %s' % synchroSuffix
+ </script>
+
+ <!-- Delete entry in "master" server -->
+ <call function="'DeleteEntry'">
+ { 'location' : clientHost,
+ 'dsPath' : clientPath,
+ 'dsInstanceHost' : masterHost ,
+ 'dsInstancePort' : master.getPort() ,
+ 'dsInstanceDn' : master.getRootDn() ,
+ 'dsInstancePswd' : master.getRootPwd() ,
+ 'dsBaseDN' : userDn }
+ </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 Encryption Tests
+ #@TestName Replication: Encryption: Modify Entry - add
+ binary attribute
+ #@TestID Modify Entry - add binary attribute
+ #@TestPurpose Check that an entry modify is well propagated
+ by secured replication.
+ #@TestPreamble
+ #@TestSteps
+ #@TestPostamble
+ #@TestResult
+ -->
+ <testcase name="getTestCaseName
+ ('Modify Entry - add binary attribute')">
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Replication: Encryption: Modify Entry - add binary attribute. \
+ Check that an entry modify is well propagated by secured \
+ replication.'
+ </message>
+
+ <script>
+ filename = 'replication_mod_add_binary.ldif'
+ filePath = '%s/%s' % (logsTestDataDir,filename)
+ binaryFilePath = '%s/photo1.uu' % testsGroupDir
+ dn = 'uid=hmiller, ou=People,%s' % synchroSuffix
+ modif = 'add'
+ attrType = 'jpegPhoto'
+ write_replication_mod_binary_ldif_file(filePath, dn, modif,
+ attrType, binaryFilePath)
+ </script>
+
+ <!-- Copy the replication_mod ldif to client host -->
+ <message>
+ 'Copy %s file from %s to %s' % (filename,logsTestDataDir,
+ clientDataDir)
+ </message>
+ <call function="'copyFile'">
+ { 'srcfile' : filePath,
+ 'destfile' : '%s/%s' % (clientDataDir,filename),
+ 'remotehost' : client.getHostname() }
+ </call>
+
+ <!-- Modify "master" server -->
+ <call function="'ldapModifyWithScript'">
+ { 'location' : clientHost,
+ 'dsPath' : clientPath,
+ 'dsInstanceHost' : masterHost ,
+ 'dsInstancePort' : master.getPort() ,
+ 'dsInstanceDn' : master.getRootDn() ,
+ 'dsInstancePswd' : master.getRootPwd() ,
+ 'dsFilename' : '%s/%s' % (clientDataDir, filename) }
+ </call>
+
+
+ <!-- Check modify worked on "master" server -->
+ <call function="'ldapSearchWithScript'">
+ { 'location' : clientHost,
+ 'dsPath' : clientPath,
+ 'dsInstanceHost' : masterHost ,
+ 'dsInstancePort' : master.getPort() ,
+ 'dsInstanceDn' : master.getRootDn() ,
+ 'dsInstancePswd' : master.getRootPwd() ,
+ 'dsBaseDN' : 'uid=hmiller, ou=People,%s' % synchroSuffix,
+ 'dsFilter' : 'jpegPhoto=*',
+ 'expectedRC' : 0 }
+ </call>
+ <script>
+ searchRC = STAXResult[0][0]
+ searchResult = STAXResult[0][1]
+ resultLength = len(searchResult) > 0
+ </script>
+ <call function="'checktestRC'">
+ { 'returncode' : resultLength ,
+ 'result' : searchResult ,
+ 'expected' : 1 }
+ </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 Encryption Tests
+ #@TestName Replication: Encryption: Modify Entry -
+ replace binary attribute
+ #@TestID Modify Entry - replace binary attribute
+ #@TestPurpose Check that an entry modify is well propagated
+ by secured replication.
+ #@TestPreamble
+ #@TestSteps
+ #@TestPostamble
+ #@TestResult
+ -->
+ <testcase name="getTestCaseName
+ ('Modify Entry - replace binary attribute')">
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Replication: Encryption: Modify Entry - replace binary attribute. \
+ Check that an entry modify is well propagated by secured \
+ replication.'
+ </message>
+
+ <script>
+ filename = 'replication_mod_replace_binary.ldif'
+ filePath = '%s/%s' % (logsTestDataDir,filename)
+ binaryFilePath = '%s/photo2.uu' % testsGroupDir
+ dn = 'uid=hmiller, ou=People,%s' % synchroSuffix
+ modif = 'replace'
+ attrType = 'jpegPhoto'
+ write_replication_mod_binary_ldif_file(filePath, dn, modif, attrType,
+ binaryFilePath)
+ </script>
+
+ <!-- Copy the replication_mod ldif to client host -->
+ <message>
+ 'Copy %s file from %s to %s' % (filename,logsTestDataDir,
+ clientDataDir)
+ </message>
+ <call function="'copyFile'">
+ { 'srcfile' : filePath,
+ 'destfile' : '%s/%s' % (clientDataDir,filename),
+ 'remotehost' : client.getHostname() }
+ </call>
+
+ <!-- Modify "master" server -->
+ <call function="'ldapModifyWithScript'">
+ { 'location' : clientHost,
+ 'dsPath' : clientPath,
+ 'dsInstanceHost' : masterHost ,
+ 'dsInstancePort' : master.getPort() ,
+ 'dsInstanceDn' : master.getRootDn() ,
+ 'dsInstancePswd' : master.getRootPwd() ,
+ 'dsFilename' : '%s/%s' % (clientDataDir, filename) }
+ </call>
+
+
+ <!-- Check modify worked on "master" server -->
+ <call function="'ldapSearchWithScript'">
+ { 'location' : clientHost,
+ 'dsPath' : clientPath,
+ 'dsInstanceHost' : masterHost ,
+ 'dsInstancePort' : master.getPort() ,
+ 'dsInstanceDn' : master.getRootDn() ,
+ 'dsInstancePswd' : master.getRootPwd() ,
+ 'dsBaseDN' : 'uid=hmiller, ou=People,%s' % synchroSuffix,
+ 'dsFilter' : 'jpegPhoto=*',
+ 'expectedRC' : 0 }
+ </call>
+ <script>
+ searchRC = STAXResult[0][0]
+ searchResult = STAXResult[0][1]
+ resultLength = len(searchResult) > 0
+ </script>
+ <call function="'checktestRC'">
+ { 'returncode' : resultLength ,
+ 'result' : searchResult ,
+ 'expected' : 1 }
+ </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 Encryption Tests
+ #@TestName Replication: Encryption: Modify Entry -
+ delete binary attribute
+ #@TestID Modify Entry - delete binary attribute
+ #@TestPurpose Check that an entry modify is well propagated
+ by secured replication.
+ #@TestPreamble
+ #@TestSteps
+ #@TestPostamble
+ #@TestResult
+ -->
+ <testcase name="getTestCaseName
+ ('Modify Entry - delete binary attribute')">
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Replication: Encryption: Modify Entry - delete binary attribute. \
+ Check that an entry modify is well propagated by secured \
+ replication.'
+ </message>
+
+
+ <script>
+ filename = 'replication_mod_delete_binary.ldif'
+ filePath = '%s/%s' % (logsTestDataDir,filename)
+ dn = 'uid=hmiller, ou=People,%s' % synchroSuffix
+ modif = 'delete'
+ attrType = 'jpegPhoto'
+ attrValue = None
+ write_replication_mod_ldif_file(filePath, dn, modif, attrType,
+ attrValue)
+ </script>
+
+ <!-- Copy the replication_mod ldif to client host -->
+ <message>
+ 'Copy %s file from %s to %s' % (filename,logsTestDataDir,
+ clientDataDir)
+ </message>
+ <call function="'copyFile'">
+ { 'srcfile' : filePath,
+ 'destfile' : '%s/%s' % (clientDataDir,filename),
+ 'remotehost' : client.getHostname() }
+ </call>
+
+ <!-- Modify "master" server -->
+ <call function="'ldapModifyWithScript'">
+ { 'location' : clientHost,
+ 'dsPath' : clientPath,
+ 'dsInstanceHost' : masterHost ,
+ 'dsInstancePort' : master.getPort() ,
+ 'dsInstanceDn' : master.getRootDn() ,
+ 'dsInstancePswd' : master.getRootPwd() ,
+ 'dsFilename' : '%s/%s' % (clientDataDir, filename) }
+ </call>
+
+ <!-- Check modify worked on "master" server -->
+ <call function="'ldapSearchWithScript'">
+ { 'location' : clientHost,
+ 'dsPath' : clientPath,
+ 'dsInstanceHost' : masterHost ,
+ 'dsInstancePort' : master.getPort() ,
+ 'dsInstanceDn' : master.getRootDn() ,
+ 'dsInstancePswd' : master.getRootPwd() ,
+ 'dsBaseDN' : 'uid=hmiller, ou=People,%s' % synchroSuffix,
+ 'dsFilter' : 'jpegPhoto=*',
+ 'expectedRC' : 0 }
+ </call>
+ <script>
+ searchRC = STAXResult[0][0]
+ searchResult = STAXResult[0][1]
+ resultLength = len(searchResult) > 0
+ </script>
+ <call function="'checktestRC'">
+ { 'returncode' : resultLength ,
+ 'result' : searchResult ,
+ 'expected' : 0 }
+ </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 Encryption Tests
+ #@TestName Replication: Encryption: Rename Entry
+ #@TestID Rename Entry
+ #@TestPurpose Check that a rename (modrdn) operation is well
+ propagated by secured replication.
+ #@TestPreamble
+ #@TestSteps
+ #@TestPostamble
+ #@TestResult
+ -->
+ <testcase name="getTestCaseName('Rename Entry')">
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Replication: Encryption: Rename Entry. Check that a rename \
+ (modrdn) operation is well propagated by secured replication.'
+ </message>
+
+ <script>
+ filename = 'replication_modrdn.ldif'
+ filePath = '%s/%s' % (logsTestDataDir,filename)
+ dn = 'uid=kvaughan, ou=People,%s' % synchroSuffix
+ newrdn = 'uid=kvaughan2'
+ newsuperior = None
+ deleteoldrdn = 1
+ write_replication_moddn_ldif_file(filePath, dn, newrdn,
+ newsuperior, deleteoldrdn)
+ </script>
+
+ <!-- Copy the replication_mod ldif to client host -->
+ <message>
+ 'Copy %s file from %s to %s' % (filename,logsTestDataDir,
+ clientDataDir)
+ </message>
+ <call function="'copyFile'">
+ { 'srcfile' : filePath,
+ 'destfile' : '%s/%s' % (clientDataDir,filename),
+ 'remotehost' : client.getHostname() }
+ </call>
+
+ <!-- Modify "master" server -->
+ <call function="'ldapModifyWithScript'">
+ { 'location' : clientHost,
+ 'dsPath' : clientPath,
+ 'dsInstanceHost' : masterHost ,
+ 'dsInstancePort' : master.getPort() ,
+ 'dsInstanceDn' : master.getRootDn() ,
+ 'dsInstancePswd' : master.getRootPwd() ,
+ 'dsFilename' : '%s/%s' % (clientDataDir, filename) }
+ </call>
+
+
+ <!-- Check modify worked on "master" server -->
+ <!-- check that "uid=kvaughan, ou=People, ${DIRECTORY_BASE}"
+ does NOT exist anymore -->
+ <call function="'ldapSearchWithScript'">
+ { 'location' : clientHost,
+ 'dsPath' : clientPath,
+ 'dsInstanceHost' : masterHost ,
+ 'dsInstancePort' : master.getPort() ,
+ 'dsInstanceDn' : master.getRootDn() ,
+ 'dsInstancePswd' : master.getRootPwd() ,
+ 'dsBaseDN' : 'uid=kvaughan, ou=People,%s' % synchroSuffix,
+ 'dsFilter' : 'objectclass=*',
+ 'expectedRC' : 32 }
+ </call>
+
+ <!-- check that new entry "uid=kvaughan2, ou=People,
+ ${DIRECTORY_BASE}" exists -->
+ <call function="'ldapSearchWithScript'">
+ { 'location' : clientHost,
+ 'dsPath' : clientPath,
+ 'dsInstanceHost' : masterHost ,
+ 'dsInstancePort' : master.getPort() ,
+ 'dsInstanceDn' : master.getRootDn() ,
+ 'dsInstancePswd' : master.getRootPwd() ,
+ 'dsBaseDN' : 'uid=kvaughan2, ou=People,%s' \
+ % synchroSuffix,
+ 'dsFilter' : 'objectclass=*' }
+ </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 Encryption Tests
+ #@TestName Replication: Encryption: Rename Entry
+ (preserving old rdn)
+ #@TestID Rename Entry (preserving old rdn)
+ #@TestPurpose Check that a rename (modrdn) operation is well
+ propagated by secured replication.
+ #@TestPreamble
+ #@TestSteps
+ #@TestPostamble
+ #@TestResult
+ -->
+ <testcase name="getTestCaseName
+ ('Rename Entry (preserving old rdn)')">
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Replication: Encryption: Rename Entry (preserving old rdn). \
+ Check that a rename (modrdn) operation is well propagated by \
+ secured replication.'
+ </message>
+
+ <script>
+ filename = 'replication_modrdn_preserve.ldif'
+ filePath = '%s/%s' % (logsTestDataDir,filename)
+ dn = 'uid=jwallace, ou=People,%s' % synchroSuffix
+ newrdn = 'uid=igueye'
+ newsuperior = None
+ deleteoldrdn = 0
+ write_replication_moddn_ldif_file(filePath, dn, newrdn,
+ newsuperior, deleteoldrdn)
+ </script>
+
+ <!-- Copy the replication_mod ldif to client host -->
+ <message>
+ 'Copy %s file from %s to %s' % (filename,logsTestDataDir,
+ clientDataDir)
+ </message>
+ <call function="'copyFile'">
+ { 'srcfile' : filePath,
+ 'destfile' : '%s/%s' % (clientDataDir,filename),
+ 'remotehost' : client.getHostname() }
+ </call>
+
+ <!-- Modify "master" server -->
+ <call function="'ldapModifyWithScript'">
+ { 'location' : clientHost,
+ 'dsPath' : clientPath,
+ 'dsInstanceHost' : masterHost ,
+ 'dsInstancePort' : master.getPort() ,
+ 'dsInstanceDn' : master.getRootDn() ,
+ 'dsInstancePswd' : master.getRootPwd() ,
+ 'dsFilename' : '%s/%s' % (clientDataDir, filename) }
+ </call>
+
+
+ <!-- Check modify worked on "master" server -->
+ <!-- check that "uid=jwallace, ou=People, ${DIRECTORY_BASE}"
+ does NOT exist anymore -->
+ <call function="'ldapSearchWithScript'">
+ { 'location' : clientHost,
+ 'dsPath' : clientPath,
+ 'dsInstanceHost' : masterHost ,
+ 'dsInstancePort' : master.getPort() ,
+ 'dsInstanceDn' : master.getRootDn() ,
+ 'dsInstancePswd' : master.getRootPwd() ,
+ 'dsBaseDN' : 'uid=jwallace, ou=People,%s' % synchroSuffix,
+ 'dsFilter' : 'objectclass=*',
+ 'expectedRC' : 32 }
+ </call>
+
+ <!-- check that new entry "uid=igueye, ou=People,
+ ${DIRECTORY_BASE}" exists -->
+ <call function="'ldapSearchWithScript'">
+ { 'location' : clientHost,
+ 'dsPath' : clientPath,
+ 'dsInstanceHost' : masterHost ,
+ 'dsInstancePort' : master.getPort() ,
+ 'dsInstanceDn' : master.getRootDn() ,
+ 'dsInstancePswd' : master.getRootPwd() ,
+ 'dsBaseDN' : 'uid=igueye, ou=People,%s' % synchroSuffix,
+ 'dsFilter' : 'uid=jwallace' }
+ </call>
+ <script>
+ searchRC = STAXResult[0][0]
+ searchResult = STAXResult[0][1]
+ resultLength = len(searchResult) > 0
+ </script>
+ <call function="'checktestRC'">
+ { 'returncode' : resultLength ,
+ 'result' : searchResult ,
+ 'expected' : 1 }
+ </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 Encryption Tests
+ #@TestName Replication: Encryption: Rename Subtree
+ #@TestID Rename Subtree
+ #@TestPurpose Check that a subtree rename (moddn) operation
+ is well propagated by secured replication.
+ #@TestPreamble
+ #@TestSteps
+ #@TestPostamble
+ #@TestResult
+ -->
+ <testcase name="getTestCaseName('Rename Subtree')">
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Replication: Encryption: Rename Subtree. Check that a subtree \
+ rename (moddn) operation is well propagated by secured \
+ replication.'
+ </message>
+
+ <script>
+ filename = 'replication_moddn.ldif'
+ filePath = '%s/%s' % (logsTestDataDir,filename)
+ dn = 'ou=People,%s' % synchroSuffix
+ newrdn = 'ou=Special People'
+ newsuperior = 'ou=Special Users,%s' % synchroSuffix
+ deleteoldrdn = 0
+ write_replication_moddn_ldif_file(filePath, dn, newrdn,
+ newsuperior, deleteoldrdn)
+ </script>
+
+ <!-- Copy the replication_mod ldif to client host -->
+ <message>
+ 'Copy %s file from %s to %s' % (filename,logsTestDataDir,
+ clientDataDir)
+ </message>
+ <call function="'copyFile'">
+ { 'srcfile' : filePath,
+ 'destfile' : '%s/%s' % (clientDataDir,filename),
+ 'remotehost' : client.getHostname() }
+ </call>
+
+ <!-- Modify "master" server -->
+ <call function="'ldapModifyWithScript'">
+ { 'location' : clientHost,
+ 'dsPath' : clientPath,
+ 'dsInstanceHost' : masterHost ,
+ 'dsInstancePort' : master.getPort() ,
+ 'dsInstanceDn' : master.getRootDn() ,
+ 'dsInstancePswd' : master.getRootPwd() ,
+ 'dsFilename' : '%s/%s' % (clientDataDir, filename) }
+ </call>
+
+
+ <!-- Check modify worked on "master" server -->
+ <!-- check that "uid=gfarmer, ou=People, ${DIRECTORY_BASE}"
+ does NOT exist anymore -->
+ <call function="'ldapSearchWithScript'">
+ { 'location' : clientHost,
+ 'dsPath' : clientPath,
+ 'dsInstanceHost' : masterHost ,
+ 'dsInstancePort' : master.getPort() ,
+ 'dsInstanceDn' : master.getRootDn() ,
+ 'dsInstancePswd' : master.getRootPwd() ,
+ 'dsBaseDN' : 'uid=gfarmer, ou=People,%s' % synchroSuffix,
+ 'dsFilter' : 'objectclass=*',
+ 'expectedRC' : 32 }
+ </call>
+
+ <!-- check that new entry "uid=gfarmer, ou=Special People,
+ ou=Special Users, ${DIRECTORY_BASE}" exists -->
+ <call function="'ldapSearchWithScript'">
+ { 'location' : clientHost,
+ 'dsPath' : clientPath,
+ 'dsInstanceHost' : masterHost ,
+ 'dsInstancePort' : master.getPort() ,
+ 'dsInstanceDn' : master.getRootDn() ,
+ 'dsInstancePswd' : master.getRootPwd() ,
+ 'dsBaseDN' : 'uid=gfarmer, ou=Special People, \
+ ou=Special Users,%s' % synchroSuffix,
+ 'dsFilter' : 'objectclass=*' }
+ </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'" />
+
+ <call function="'testSuite_Postamble'"/>
+
+ </sequence>
+
+ </block>
+
+ </sequence>
+
+ </function>
+
+</stax>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/replication/failover/failover.xml b/opendj-sdk/opends/tests/functional-tests/testcases/replication/failover/failover.xml
index e98944a..4fdc46b 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/replication/failover/failover.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/replication/failover/failover.xml
@@ -63,8 +63,7 @@
</call>
<script>
- synchroSuffix = master.getSynchronizedSuffixList()[0].getSuffixDn()
- replServerList = master.getSynchronizedSuffixList()[0].getChangelogServerList()
+ synchroSuffix = master.getSynchronizedSuffixList()[0].getSuffixDn()
</script>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/replication/replication.xml b/opendj-sdk/opends/tests/functional-tests/testcases/replication/replication.xml
index 3742db1..577e09f 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/replication/replication.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/replication/replication.xml
@@ -36,11 +36,14 @@
envAlreadyLoaded='true'
CurrentTestPath['group']='replication'
</script>
- <call function="'testGroup_Preamble'"/>
- <iterate var="_test" in="['totalupdate','binarycopy','ldifimport','resynchronization','basic','schema','failover']">
+ <call function="'testGroup_Preamble'"/>
+ <iterate var="_test"
+ in="['totalupdate','binarycopy','ldifimport','resynchronization',
+ 'basic','schema','failover','encryption']">
<sequence>
<import machine="STAF_LOCAL_HOSTNAME"
- file="'%s/testcases/replication/%s/%s.xml' % (TESTS_DIR,_test,_test)"/>
+ file="'%s/testcases/replication/%s/%s.xml' %
+ (TESTS_DIR,_test,_test)"/>
<call function="'replication_%s'% _test" />
</sequence>
</iterate>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/replication/replication_setup.xml b/opendj-sdk/opends/tests/functional-tests/testcases/replication/replication_setup.xml
index c40237c..e1a0127 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/replication/replication_setup.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/replication/replication_setup.xml
@@ -31,12 +31,23 @@
<function name="replication_setup">
<function-map-args>
- <function-arg-def name="topologyFile" type="optional" default="'%s/config/replication/basic_topology.txt' % TESTS_DIR">
+ <function-arg-def name="topologyFile"
+ type="optional"
+ default="'%s/config/replication/basic_topology.txt'
+ % TESTS_DIR">
<function-arg-description>
Pathname to file describing the topology.
</function-arg-description>
<function-arg-property name="type" value="filepath"/>
</function-arg-def>
+ <function-arg-def name="secureReplication"
+ type="optional"
+ default="None">
+ <function-arg-description>
+ Encrypt replication channels
+ </function-arg-description>
+ <function-arg-property name="type" value="boolean"/>
+ </function-arg-def>
</function-map-args>
<sequence>
@@ -95,7 +106,8 @@
<iterate var="server" in="consumerList">
<sequence>
<!-- Configure replication if required so by the server
- ! (i.e. server is a changelog server and/or has synchronized suffixes)
+ ! (i.e. server is a changelog server and/or has synchronized
+ ! suffixes)
-->
<if expr="server.requiresSynchronization()">
<sequence>
@@ -112,7 +124,10 @@
</script>
<message>
- 'Enable replication for server:\nHost: %s\nLdap port: %s\nReplication port: %s\nReplicated DN list: %s' % (server.getHostname(), server.getPort(), replicationServer.getPort(), replicatedDnList)
+ 'Enable replication for server:\nHost: %s\nLdap port: %s\n\
+ Replication port: %s\nReplicated DN list: %s' \
+ % (server.getHostname(), server.getPort(),
+ replicationServer.getPort(), replicatedDnList)
</message>
<call function="'enableReplication'">
@@ -123,11 +138,13 @@
'dsInstanceDn' : server.getRootDn(),
'dsInstancePswd' : server.getRootPwd(),
'dsReplicationPort' : replicationServer.getPort(),
+ 'dsSecureReplication' : secureReplication,
'refInstanceHost' : masterHost,
'refInstancePort' : master.getPort(),
'refInstanceDn' : master.getRootDn(),
'refInstancePswd' : master.getRootPwd(),
'refReplicationPort' : masterReplicationServer.getPort(),
+ 'refSecureReplication' : secureReplication,
'replicationDnList' : replicatedDnList,
'useSecondServerAsSchemaSource' : True }
</call>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/replication/totalupdate/totalupdate.xml b/opendj-sdk/opends/tests/functional-tests/testcases/replication/totalupdate/totalupdate.xml
index 1e67d8e..1f13e24 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/replication/totalupdate/totalupdate.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/replication/totalupdate/totalupdate.xml
@@ -40,7 +40,8 @@
<call function="'testSuite_Preamble'"/>
<import machine="STAF_LOCAL_HOSTNAME"
- file="'%s/testcases/replication/replication_setup.xml' % (TESTS_DIR)"/>
+ file="'%s/testcases/replication/replication_setup.xml'
+ % (TESTS_DIR)"/>
<call function="'replication_setup'" />
<script>
@@ -64,7 +65,8 @@
<call function="'testCase_Preamble'"/>
<message>
- 'Replication: Total Update: Simple LDIF. Initialize server with total update'
+ 'Replication: Total Update: Simple LDIF. Initialize server with \
+ total update'
</message>
<!-- Stop "master" Directory Server -->
@@ -155,7 +157,35 @@
</sequence>
</iterate>
- <!-- Verify the synchronization of the trees among the servers in the topology -->
+ <!-- To make sure replication is working: add entry to "master"
+ server -->
+ <script>
+ listAttr = []
+ listAttr.append('objectclass:top')
+ listAttr.append('objectclass:organizationalperson')
+ listAttr.append('objectclass:inetorgperson')
+ listAttr.append('objectclass:person')
+ listAttr.append('givenname: Professor Moriarty')
+ listAttr.append('sn: Moriarty')
+ listAttr.append('cn: Professor Moriarty')
+ listAttr.append('l: London')
+ </script>
+
+ <call function="'addAnEntry'">
+ { 'location' : masterHost,
+ 'dsPath' : masterPath,
+ 'dsInstanceHost' : masterHost,
+ 'dsInstancePort' : master.getPort(),
+ 'dsInstanceDn' : master.getRootDn(),
+ 'dsInstancePswd' : master.getRootPwd(),
+ 'DNToAdd' : 'uid=pmoriarty, ou=People, o=example',
+ 'listAttributes' : listAttr,
+ 'expectedRC' : 0
+ }
+ </call>
+
+ <!-- Verify the synchronization of the trees among the servers in
+ the topology -->
<call function="'verifyTrees'">
[ clientHost, clientPath, master, consumerList, 'o=example' ]
</call>
@@ -182,15 +212,17 @@
<call function="'testCase_Preamble'"/>
<message>
- 'Replication: Total Update: Schema total update. Initialize schema with total update'
+ 'Replication: Total Update: Schema total update. \
+ Initialize schema with total update'
</message>
<script>
consumer = consumerList[0]
</script>
- <!-- Try to add entry belonging to new schema (see replication setup)
- to "consumer" server; should be rejected with error 65 (objectclass violation) -->
+ <!-- Try to add entry belonging to new schema (see replication
+ setup) to "consumer" server; should be rejected with error 65
+ (objectclass violation) -->
<call function="'addEntry'">
{ 'location' : clientHost,
'dsPath' : clientPath,
@@ -198,7 +230,8 @@
'dsInstancePort' : consumer.getPort(),
'dsInstanceDn' : consumer.getRootDn(),
'dsInstancePswd' : consumer.getRootPwd(),
- 'entryToBeAdded' : '%s/replication/testuser-1.ldif' % clientDataDir,
+ 'entryToBeAdded' : '%s/replication/testuser-1.ldif' \
+ % clientDataDir,
'expectedRC' : 65 }
</call>
@@ -213,8 +246,11 @@
</call>
<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\' )'
+ 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>
<!-- Modify schema in "master" server -->
@@ -265,15 +301,18 @@
'dsInstancePort' : consumer.getPort(),
'dsInstanceDn' : consumer.getRootDn(),
'dsInstancePswd' : consumer.getRootPwd(),
- 'entryToBeAdded' : '%s/replication/testuser-1.ldif' % clientDataDir }
+ 'entryToBeAdded' : '%s/replication/testuser-1.ldif' \
+ % clientDataDir }
</call>
- <!-- Verify the synchronization of the schema among the servers in the topology -->
+ <!-- Verify the synchronization of the schema among the servers
+ in the topology -->
<call function="'verifySchemas'">
[ clientHost, clientPath, master, consumerList, '99-user.ldif' ]
</call>
- <!-- Verify the synchronization of the trees among the servers in the topology -->
+ <!-- Verify the synchronization of the trees among the servers in
+ the topology -->
<call function="'verifyTrees'">
[ clientHost, clientPath, master, consumerList, 'o=example' ]
</call>
@@ -304,7 +343,8 @@
<call function="'testCase_Preamble'"/>
<message>
- 'Replication: Total Update: Initialize all. Initialize all servers with total update'
+ 'Replication: Total Update: Initialize all. Initialize all servers with \
+ total update'
</message>
<!-- Stop "master" Directory Server -->
@@ -325,7 +365,7 @@
{ 'location' : masterHost,
'dsPath' : masterPath,
'dsBackEnd' : 'userRoot',
- 'dsLdifFile' : '%s/replication/Short_Example.ldif' % masterDataDir
+ 'dsLdifFile' : '%s/replication/Short_Example.ldif' % masterDataDir
}
</call>
@@ -393,23 +433,52 @@
</call>
</sequence>
</iterate>
-
- <!-- Verify the synchronization of the trees among the servers in the topology -->
+
+ <!-- To make sure replication is working: add entry to "master"
+ server -->
+ <script>
+ listAttr = []
+ listAttr.append('objectclass:top')
+ listAttr.append('objectclass:organizationalperson')
+ listAttr.append('objectclass:inetorgperson')
+ listAttr.append('objectclass:person')
+ listAttr.append('givenname: Professor Moriarty')
+ listAttr.append('sn: Moriarty')
+ listAttr.append('cn: Professor Moriarty')
+ listAttr.append('l: London')
+ </script>
+
+ <call function="'addAnEntry'">
+ { 'location' : masterHost,
+ 'dsPath' : masterPath,
+ 'dsInstanceHost' : masterHost,
+ 'dsInstancePort' : master.getPort(),
+ 'dsInstanceDn' : master.getRootDn(),
+ 'dsInstancePswd' : master.getRootPwd(),
+ 'DNToAdd' : 'uid=pmoriarty, ou=People, o=example',
+ 'listAttributes' : listAttr,
+ 'expectedRC' : 0
+ }
+ </call>
+
+ <!-- Verify the synchronization of the trees among the servers in
+ the topology -->
<call function="'verifyTrees'">
[ clientHost, clientPath, master, consumerList, 'o=example' ]
</call>
-<!--
+
<script>
- knownIssue(2425)
+ knownIssue(2633)
</script>
--->
+
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<import machine="STAF_LOCAL_HOSTNAME"
- file="'%s/testcases/replication/replication_cleanup.xml' % (TESTS_DIR)"/>
+ file="'%s/testcases/replication/replication_cleanup.xml'
+ % (TESTS_DIR)"/>
<call function="'replication_cleanup'" />
<call function="'testSuite_Postamble'"/>
diff --git a/opendj-sdk/opends/tests/shared/functions/utils.xml b/opendj-sdk/opends/tests/shared/functions/utils.xml
index fce3da0..471cf6b 100755
--- a/opendj-sdk/opends/tests/shared/functions/utils.xml
+++ b/opendj-sdk/opends/tests/shared/functions/utils.xml
@@ -1495,13 +1495,18 @@
Kill the ldap server
</function-prolog>
<function-map-args>
- <function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
+ <function-arg-def name="location"
+ type="optional"
+ default="STAF_REMOTE_HOSTNAME">
<function-arg-description>
Location of target host
</function-arg-description>
<function-arg-property name="type" value="hostname"/>
</function-arg-def>
- <function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
+ <function-arg-def name="dsPath"
+ type="optional"
+ default="'%s/%s'
+ % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<function-arg-description>
Pathname to installation root
</function-arg-description>
@@ -1516,10 +1521,21 @@
<script>
pidPath = '%s/logs/server.pid' % dsPath
- pidFile = open(pidPath, 'r')
- pid = pidFile.readline()[:-1]
- pidFile.close()
+ _args = '%s' % pidPath
+ </script>
+ <call function="'runSTAFCommand'">
+ { 'name' : 'Read server pid file',
+ 'location' : location,
+ 'service' : 'FS',
+ 'request' : 'GET FILE',
+ 'arguments' : _args
+ }
+ </call>
+
+ <script>
+ pid = STAXResult[:-1]
+
if isWindows:
_cmd = 'tskill'
_args = pid
--
Gitblit v1.10.0