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/encryption/encryption.xml | 1055 +++++++---------------------------------------------------
 1 files changed, 128 insertions(+), 927 deletions(-)

diff --git a/opends/tests/staf-tests/functional-tests/testcases/replication/encryption/encryption.xml b/opends/tests/staf-tests/functional-tests/testcases/replication/encryption/encryption.xml
index ef5b0ea..4c7c348 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/replication/encryption/encryption.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/replication/encryption/encryption.xml
@@ -7,953 +7,154 @@
  ! 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-2010 Sun Microsystems, Inc.
- !      Portions Copyright 2011-2012 ForgeRock AS.
+ !      Copyright 2012 ForgeRock AS.
  ! -->
 <stax>
-
   <defaultcall function="replication_encryption"/>
-
-  <function name="replication_encryption">
-
+  <function name="replication_encryption" scope="local">
     <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/3server_topology.txt' \
-                                    % REPLICATION_CONFIG_DIR,
-              'secureReplication': True,
-              'dataFile'         : 'Example.ldif',
-              'label'            : 'Replication Encryption'
-            }
-          </call>
-                                    
-          <script>
-            consumer = consumerList[0]
-          </script>        
-
-            
-                        
-          <!--- 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
-                    }
-                  </call>
+      <block name="'replication_encryption'">
+        <try>
+          <sequence>
+            <script>
+              CurrentTestPath['group'] = 'replication'        
+              CurrentTestPath['suite'] = 'encryption'
               
-                </sequence>
-              </iterate>
-                
-              <!-- Verify the synchronization of the trees among the servers in 
-                the topology -->          
-              <call function="'verifyTrees'">
-                [ clientHost, clientPath, master, consumerList, synchroSuffix ]
-              </call> 
+              _group=CurrentTestPath['group']
+              _groupdir='%s/testcases/%s' % (TESTS_DIR,_group)
+              _label = 'Replication Encryption'
+            </script>
 
-
-              <call function="'testCase_Postamble'"/>
-            </sequence>
-          </testcase>
-          
-
-          <!--- Test Case information
-          #@TestMarker          Replication Encryption Tests
-          #@TestName            Replication: Encryption: Add entry after restart
-          #@TestID              Add entry after restart
-          #@TestPurpose         Check entry add over secured replication after
-                                server restart
-          #@TestPreamble
-          #@TestSteps           Restart servers
-          #@TestSteps           Add entry
-          #@TestPostamble
-          #@TestResult          Success if trees synchronised over the topology
-          -->
-          <testcase name="getTestCaseName('Add entry after restart')">
-            <sequence>            
-              <call function="'testCase_Preamble'"/>
-              <message>
-                'Replication: Encryption: Add entry after restart. \
-                Check entry add over secured replication after server restart'
-              </message>
-
-              <!-- Stop the servers in the topology -->
-              <call function="'stopServers'">
-                [_splitServerList]
-              </call>
-              
-              <!-- Start the servers in the topology -->  
-              <call function="'startServers'">
-                [_splitServerList]
-              </call>
-              
-              <iterate var="server" in="_topologyServerList" indexvar="i">
-                <sequence>
-                  <script>
-                    serverPath = '%s/%s' % (server.getDir(), OPENDSNAME)
-                    userDn = 'uid=RESTART-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
-                    }
-                  </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>
-              
-              <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>
-                                    
-                  <!-- Modify entry on one of the servers -->
-                  <call function="'modifyAnAttribute'">
-                    { 'location'          : server.getHostname(),
-                      'dsPath'            : serverPath,
-                      'dsInstanceHost'    : server.getHostname(),
-                      'dsInstancePort'    : server.getPort(),
-                      'dsInstanceDn'      : server.getRootDn(),
-                      'dsInstancePswd'    : server.getRootPwd(),
-                      'DNToModify'        : userDn,
-                      'attributeName'     : 'l',
-                      'newAttributeValue' : 'GEC',
-                      'changetype'        : 'replace'
-                    }
-                  </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: 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>
-
-              <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>
-                    
-                  <!-- Delete entry on one of the servers -->    
-                  <call function="'DeleteEntry'">
-                    { 'location'       : server.getHostname(),
-                      'dsPath'         : serverPath,
-                      'dsInstanceHost' : server.getHostname(),
-                      'dsInstancePort' : server.getPort() ,
-                      'dsInstanceDn'   : server.getRootDn() ,
-                      'dsInstancePswd' : server.getRootPwd() ,
-                      'dsBaseDN'       : userDn
-                    }
-                  </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 - 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' % (local.temp,filename)
-                binaryFilePath = '%s/replication/photo1.uu' % source.data
-                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,local.temp,
-                                                client.getTmpDir())
-              </message>
-              <call function="'copyFile'">
-                { 'srcfile'    : filePath,
-                  'destfile'   : '%s/%s' % (client.getTmpDir(),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' % (client.getTmpDir(), 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' % (local.temp,filename)
-                binaryFilePath = '%s/replication/photo2.uu' % source.data
-                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,local.temp,
-                                                client.getTmpDir())
-              </message>
-              <call function="'copyFile'">
-                { 'srcfile'    : filePath,
-                  'destfile'   : '%s/%s' % (client.getTmpDir(),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' % (client.getTmpDir(), 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' % (local.temp,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,local.temp,
-                                                client.getTmpDir())
-              </message>
-              <call function="'copyFile'">
-                { 'srcfile'    : filePath,
-                  'destfile'   : '%s/%s' % (client.getTmpDir(),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' % (client.getTmpDir(), 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' % (local.temp,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,local.temp,
-                                                client.getTmpDir())
-              </message>
-              <call function="'copyFile'">
-                { 'srcfile'    : filePath,
-                  'destfile'   : '%s/%s' % (client.getTmpDir(),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' % (client.getTmpDir(), 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' % (local.temp,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,local.temp,
-                                                client.getTmpDir())
-              </message>
-              <call function="'copyFile'">
-                { 'srcfile'    : filePath,
-                  'destfile'   : '%s/%s' % (client.getTmpDir(),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' % (client.getTmpDir(), 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' % (local.temp,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,local.temp,
-                                                client.getTmpDir())
-              </message>
-              <call function="'copyFile'">
-                { 'srcfile'    : filePath,
-                  'destfile'   : '%s/%s' % (client.getTmpDir(),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' % (client.getTmpDir(), 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'" >
-            { 'label'    : 'Replication Encryption' }
-          </call>
-
-          <call function="'testSuite_Postamble'"/>
+            <!--- Test Suite information
+            #@TestSuiteName       Replication Encryption Tests
+            #@TestSuitePurpose    Verify that the encrypted operations are replicated
+                                  correctly between two servers.
+            #@TestSuiteID         Encryption Tests
+            #@TestSuiteGroup      Encryption
+            #@TestGroup           Replication
+            #@TestScript          replication_encryption.xml
+            #@TestHTMLLink        http://www.forgerock.org/
+              -->
                   
-        </sequence>
+            <call function="'testSuite_Preamble'"/>
 
+            <try>
+              <sequence> 
+
+                <import machine="STAF_LOCAL_HOSTNAME"
+                  file="'%s/testcases/replication/replication_setup.xml'
+                        % (TESTS_DIR)"/>
+                <call function="'replication_setup'">
+                  { 'topologyFile'     : '%s/3server_topology.txt' \
+                                          % REPLICATION_CONFIG_DIR,
+                    'secureReplication': True,
+                    'dataFile'         : 'Example.ldif',
+                    'label'            : 'Replication Encryption'
+                  }
+                </call>
+
+                <!-- List of Import of Test Functions -->
+                <script>
+                  importList=[]
+                  importList.append('encryption/encryption_tests')
+                </script>
+
+                <!-- Import the files for this test suite -->
+                <iterate var="_import" in="importList">
+                  <import machine="STAF_LOCAL_HOSTNAME"
+                    file="'%s/%s.xml' % (_groupdir,_import)"/>
+                </iterate>                                                                       
+
+                <!-- Specific to replication tests -->
+                <script>
+                  msg1 = 'Replication: Encryption:'
+                  consumer = consumerList[0]
+                </script>
+                                                    
+                <!-- List of Test Cases -->
+                <script>
+                  testsList=[]
+                  testsList.append('replication_encryption_001')
+                  testsList.append('replication_encryption_002')
+                  testsList.append('replication_encryption_003')
+                  testsList.append('replication_encryption_004')
+                  testsList.append('replication_encryption_005')
+                  testsList.append('replication_encryption_006')
+                  testsList.append('replication_encryption_007')
+                  testsList.append('replication_encryption_008')
+                  testsList.append('replication_encryption_009')
+                  testsList.append('replication_encryption_010')
+                </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