From b643c10a26a80d6270e53229ff61cc730e5a748e Mon Sep 17 00:00:00 2001
From: ugaston <ugaston@localhost>
Date: Fri, 18 May 2007 10:47:47 +0000
Subject: [PATCH] Setting execution granularity at Suite level: Part 2

---
 opends/tests/functional-tests/testcases/security/jks/security_jks.xml                               |   52 -
 opends/tests/functional-tests/testcases/schema/schema_rfc_tests.xml                                 |   22 
 opends/tests/functional-tests/testcases/security/pkcs12/security_pkcs12.xml                         |   51 -
 opends/tests/functional-tests/testcases/schema/schema_setup.xml                                     |   93 ++
 opends/tests/functional-tests/testcases/synchronization/basic/synchronization_basic_bob.xml         |   10 
 opends/tests/functional-tests/testcases/schema/schema.xml                                           |   45 -
 opends/tests/functional-tests/testcases/security/security_cleanup.xml                               |   94 +++
 opends/tests/functional-tests/testcases/synchronization/basic/synchronization_basic.xml             |   12 
 opends/tests/functional-tests/testcases/security/account_activation/security_account_activation.xml |   55 -
 opends/tests/functional-tests/testcases/security/pwd_policy_root/security_pwd_policy_root.xml       |   53 -
 opends/tests/functional-tests/testcases/security/auth_pwd_syntax/security_auth_pwd_syntax.xml       |   50 -
 opends/tests/functional-tests/testcases/security/bind_no_pwd/security_bind_no_pwd.xml               |   52 -
 opends/tests/functional-tests/shared/data/security/startTLS/setup/enable_key_mgr_provider.ldif      |    2 
 opends/tests/functional-tests/testcases/security/security.xml                                       |    8 
 opends/tests/functional-tests/testcases/schema/schema_cleanup.xml                                   |   94 +++
 opends/tests/functional-tests/testcases/security/pwd_storage/security_pwd_storage.xml               |   53 -
 opends/tests/functional-tests/testcases/security/pwd_policy/security_pwd_policy.xml                 |   51 -
 opends/tests/functional-tests/shared/functions/environment.xml                                      |  190 ++++++
 opends/tests/functional-tests/testcases/security/sasl/security_sasl.xml                             |   53 -
 opends/tests/functional-tests/testcases/security/jks/security_setup_jks.xml                         |    2 
 opends/tests/functional-tests/testcases/runFuncTests.xml                                            |   96 --
 opends/tests/functional-tests/testcases/security/startTLS/security_startTLS.xml                     |   84 +-
 opends/tests/functional-tests/shared/functions/dsadm.xml                                            |   20 
 opends/tests/functional-tests/shared/functions/topology.xml                                         |  343 ++++++++--
 opends/tests/functional-tests/testcases/security/pwd_validator/security_pwd_validator.xml           |   45 -
 opends/tests/functional-tests/testcases/schema/schema_dynamic.xml                                   |   18 
 opends/tests/functional-tests/testcases/security/security_setup.xml                                 |   99 +++
 27 files changed, 1,051 insertions(+), 696 deletions(-)

diff --git a/opends/tests/functional-tests/shared/data/security/startTLS/setup/enable_key_mgr_provider.ldif b/opends/tests/functional-tests/shared/data/security/startTLS/setup/enable_key_mgr_provider.ldif
index 58a7beb..64cef2b 100644
--- a/opends/tests/functional-tests/shared/data/security/startTLS/setup/enable_key_mgr_provider.ldif
+++ b/opends/tests/functional-tests/shared/data/security/startTLS/setup/enable_key_mgr_provider.ldif
@@ -30,3 +30,5 @@
 -
 replace: ds-cfg-key-store-pin
 ds-cfg-key-store-pin: servercert
+-
+delete: ds-cfg-key-store-pin-file
diff --git a/opends/tests/functional-tests/shared/functions/dsadm.xml b/opends/tests/functional-tests/shared/functions/dsadm.xml
index 18b6210..6b70a8a 100755
--- a/opends/tests/functional-tests/shared/functions/dsadm.xml
+++ b/opends/tests/functional-tests/shared/functions/dsadm.xml
@@ -51,6 +51,12 @@
         </function-arg-description>
         <function-arg-property name="type" value="Port number"/>
       </function-arg-def>
+      <function-arg-def name="dsJmxPort" type="optional">
+        <function-arg-description>
+          Directory server JMX port number
+        </function-arg-description>
+        <function-arg-property name="type" value="Port number"/>
+      </function-arg-def>		
       <function-arg-def name="dsBaseDN" type="optional">
         <function-arg-description>
           Base DN (only single base DN supported).
@@ -91,12 +97,16 @@
         STAFCmdParams=''
 
         if dsPath:
-          dsBinPath='%s/%s' % (dsPath,fileFolder) 
-          STAFCmd='%s/configure-ds%s' % (dsBinPath,fileExt)
+          STAFCmd='%s/setup%s' % (dsPath,fileExt)
+          STAFCmdParamsList.append('--cli')
+          STAFCmdParamsList.append('-s')	  
                   
         if dsPort:
           STAFCmdParamsList.append('-p %s' % dsPort)
         
+        if dsJmxPort:
+          STAFCmdParamsList.append('-x %s' % dsJmxPort)
+        		  
         if dsBaseDN:
           STAFCmdParamsList.append('-b "%s"' % dsBaseDN)
 
@@ -107,7 +117,7 @@
           STAFCmdParamsList.append('-w "%s"' % dsBindPwd)
         
         if dsBindPwdFile:
-          STAFCmdParamsList.append('-W "%s"' % dsBindPwdFile)
+          STAFCmdParamsList.append('-j "%s"' % dsBindPwdFile)
         
         if dsHelp:
           STAFCmdParamsList.append('-H')
@@ -123,9 +133,9 @@
         <location>'%s' % location</location>
         <command>'%s' % STAFCmd</command>
         <parms>'%s' % STAFCmdParams</parms>
-        <workdir>'%s' % dsBinPath</workdir>
+        <workdir>'%s' % dsPath</workdir>
         <envs>
-          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
+          ['PATH=/bin:/usr/bin:%s' % dsPath, 'JAVA_HOME=%s' % JAVA_HOME]
         </envs>
         <console use="'same'"/>
         <stderr mode="'stdout'"/>
diff --git a/opends/tests/functional-tests/shared/functions/environment.xml b/opends/tests/functional-tests/shared/functions/environment.xml
new file mode 100755
index 0000000..cd480cb
--- /dev/null
+++ b/opends/tests/functional-tests/shared/functions/environment.xml
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE stax SYSTEM "../../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>
+	
+  <function name="importSharedLibraries">
+    <function-prolog>
+		This function imports the shared function xml libraries.
+	</function-prolog>   	  
+	  
+	<sequence>
+		
+      <!--- Import all the shared xml libraries -->
+      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+        file="'%s/utils.xml' % (TESTS_FUNCTIONS_DIR)" />
+
+      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+        file="'%s/stafcmd.xml' % (TESTS_FUNCTIONS_DIR)" />
+
+      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+        file="'%s/staxcmd.xml' % (TESTS_FUNCTIONS_DIR)" />
+
+      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+        file="'%s/dsadm.xml' % (TESTS_FUNCTIONS_DIR)" />
+
+      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+        file="'%s/ldap.xml' % (TESTS_FUNCTIONS_DIR)" />
+
+      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+        file="'%s/security.xml' % (TESTS_FUNCTIONS_DIR)" />
+		
+	  <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+        file="'%s/topology.xml' % (TESTS_FUNCTIONS_DIR)" />
+        
+      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+        file="'%s/signals.xml' % (TESTS_FUNCTIONS_DIR)" />
+
+				
+	</sequence>  
+	    
+  </function>
+
+	
+	
+	
+  <function name="importPythonLibraries">
+    <function-prolog>
+		This function imports the Python libraries and objects, 
+		both starndard and local shared ones.
+	</function-prolog>	  
+	 
+    <sequence>
+		
+      <!-- Load in any standard python libraries -->
+      <script>
+        import re
+        import posixpath
+        import sys
+      </script>
+
+      <!-- Load in any standard python functions -->
+      <script>
+        from time import localtime,strftime
+      </script> 
+
+      <!-- Load in the local shared python objects from libraries -->
+      <script>
+        sys.path.append("%s/python" % TESTS_SHARED_DIR )
+        from common import *
+        from security import *
+        from synchronization import *
+      </script>     
+												
+		
+	</sequence>
+  </function>	
+	
+	
+	
+		
+
+  <function name="initialiseGlobalVariables">
+    <function-prolog>
+		This function initialises a set of global variables.
+	</function-prolog>
+	  
+    <sequence>
+		
+      <!-- Resolve any OS related variables -->           
+      <call function="'setOSvariables'">
+        { 'hostname' : STAF_REMOTE_HOSTNAME }
+      </call>
+
+      <!-- XXXX this needs some cleanup XXXX -->
+      <script>
+        STAXLogMessage = 1 
+        LogDir='%s' % TMPDIR
+        SRCFILE = '%s/%s' % (ZIPPATH,ZIPNAME) 
+        DSTFILE = '%s/%s' % (TMPDIR,ZIPNAME)
+        OPENDS_BINPATH ='%s/%s/bin' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME) 
+        OSName= STAXResult
+        winPattern=re.compile('win', re.IGNORECASE)
+        isWindows=winPattern.search(OSName)
+        if isWindows:
+          fileExt='.bat'
+          fileFolder='bat'
+        else:
+          fileExt=''
+          fileFolder='bin'
+      </script>
+      
+      <!-- Set the signal handlers -->          
+      <call function="'signals'"/>
+      
+      <!-- Initialize any global variables -->
+      <script>
+        CurrentTestPath={}
+        True = 1
+        False = 0		  		  
+      </script>
+					
+			
+	</sequence> 	  
+  </function>
+
+
+
+	
+	
+  <function name="loadEnvironment">
+    <function-prolog>
+      This function loads the environment (libraries, functions, variables)
+	  needed by the tests.
+	</function-prolog>
+	  
+    <sequence>
+
+	  <message>
+	    'Load environment for test suite execution.'  
+	  </message>		
+
+	  <call function="'importSharedLibraries'"/>
+		
+	  <call function="'importPythonLibraries'"/>
+		
+	  <call function="'initialiseGlobalVariables'"/>
+		  		
+<!--
+      <call function="'prepareInstanceCreation'"></call>						  		
+-->					
+		
+						
+      <call function="'checkRC'">
+        { 'returncode' : RC ,
+          'result'     : STAXResult }
+      </call>
+        
+		
+	</sequence>	
+	  
+  </function>	
+	
+
+
+		
+</stax>
\ No newline at end of file
diff --git a/opends/tests/functional-tests/shared/functions/topology.xml b/opends/tests/functional-tests/shared/functions/topology.xml
index f51f5ad..012c8c9 100755
--- a/opends/tests/functional-tests/shared/functions/topology.xml
+++ b/opends/tests/functional-tests/shared/functions/topology.xml
@@ -31,17 +31,25 @@
     <function-prolog>
 		This function creates the topology required by the Test Group/Suite.
 	</function-prolog>   	  
-	<function-map-args>
+	<function-map-args>		  
 	  <function-arg-def name="topologyDescFile" type="optional" default="None">
 	    <function-arg-description>
 		  Topology Description file
 		</function-arg-description>
 		<function-arg-property name="type" value="filePath"/>			
-	  </function-arg-def>	
+	  </function-arg-def>
+	  <function-arg-def name="initialiseInstance" type="optional" default="False">
+	    <function-arg-description>
+		  Specifies whether the instance should be initialised with some default data.
+		</function-arg-description>
+		<function-arg-property name="type" value="boolean"/>
+	  </function-arg-def>			
 	</function-map-args>
 	  
 	<sequence>
 
+      <call function="'prepareInstanceCreation'"></call>		
+
 	  <if expr="topologyDescFile == None">	
 		  <!-- SINGLE instance deployment: read parameters from config.py (done by default) -->
 		  <sequence>
@@ -51,6 +59,17 @@
 			  
 		    <call function="'createInstance'"></call>
 			  
+	        <if expr="RC == 0 and initialiseInstance == True">
+	          <sequence>
+			
+                <!-- Load the server with default data -->
+                <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+                  file="'%s/testcases/quickstart/quickstart.xml' % (TESTS_DIR)" />			
+                <call function="'main_quickstart'"/>		  
+			
+		      </sequence>
+	        </if>			  
+			  
 		  </sequence>
 	  		  
 	  <else>
@@ -78,6 +97,7 @@
 				    'dsDir' : server.getDir(),
 					'dsPort' : server.getPort(),
 					'dsSslPort' : server.getSslPort(),
+					'dsJmxPort' : server.getJmxPort(),
 					'dsBindDN' : server.getRootDn(),
 					'dsBindPwd' : server.getRootPwd(),
 					'dsBaseDN' : server.getBaseDn() }
@@ -111,7 +131,85 @@
 	</sequence>  
 	    
   </function>
+
 	
+	
+	
+  <function name="prepareInstanceCreation">
+    <function-prolog>
+		This function prepares locally the necessary 
+		files  to create an instance: data zip file and OpenDS zip file.
+	</function-prolog>	  
+	 
+    <sequence>
+
+      <!-- ON LOCAL HOST: get data ready to copy to remote host -->
+          <!-- Locally delete any existing files from staging area -->
+          <message>'Delete the temporary staging area'</message>
+          <call function="'deleteFolder'">
+            { 'location'   :  STAXServiceMachine,
+              'foldername' : '%s' % TMP_DATA_DIR }
+          </call>				
+		
+          <!-- Locally delete any existing files from the zip archive -->
+          <message>'Delete existing zip archive.'</message>
+          <call function="'deleteFile'">
+              { 'location' : STAXServiceMachine,
+                'filename' : '%s/ldifdata.zip' % TMPDIR }
+          </call>
+		
+				
+          <!-- Locally copy static data files to temporary staging area -->
+          <!-- LDIF (.ldif) files -->
+          <message>'Copy ldif data files'</message>
+          <call function="'CopyFolderByExtension'">
+              { 'location'   : STAXServiceMachine,
+                'srcfolder'  : TESTS_DIR,
+                'destfolder' : TMP_DATA_DIR,
+                'extension'  : 'ldif' }
+          </call>
+    
+          <!-- PWD (.pwd) files -->
+          <call function="'CopyFolderByExtension'">
+              { 'location'   : STAXServiceMachine,
+                'srcfolder'  : TESTS_DIR,
+                'destfolder' : TMP_DATA_DIR,
+                'extension'  : 'pwd' }
+          </call>
+    
+          <!-- Archive (.gz) files -->
+          <message>'Copy gz data files'</message>
+          <call function="'CopyFolderByExtension'">
+              { 'location'   : STAXServiceMachine,
+                'srcfolder'  : TESTS_DIR,
+                'destfolder' : TMP_DATA_DIR,
+                'extension'  : 'gz' }
+          </call>
+    
+          <!-- Dynamically create ldif files for staging -->
+          <!-- Modify SSL port to a user-defined value -->
+          <script>
+            write_ldaps_ldif_file('%s/shared/data' % (TMP_DATA_DIR), '%s' % (DIRECTORY_INSTANCE_SSL_PORT));
+          </script>
+        
+          <!--  Zip up contents of tests directory -->
+          <message>
+              'Zip up data directory.'
+          </message>
+          <call function="'zipUpFile'">
+            { 'location'   : STAXServiceMachine,
+              'zipfile'    : '%s/ldifdata.zip' % TMPDIR , 
+              'folder'     : TMP_DATA_DIR ,
+              'relativeto' : TMPDIR }
+          </call>		
+												
+		
+	</sequence>
+  </function>	
+	
+	
+	
+		
 
   <function name="createInstance">
     <function-prolog>
@@ -145,6 +243,12 @@
 		</function-arg-description>
         <function-arg-property name="type" value="Port number"/>
 	  </function-arg-def>
+	  <function-arg-def name="dsJmxPort" type="optional" default="None">
+	    <function-arg-description>
+		  Directory Server JMX port number			
+		</function-arg-description>
+        <function-arg-property name="type" value="Port number"/>
+	  </function-arg-def>		
 	  <function-arg-def name="dsBindDN" type="optional" default="DIRECTORY_INSTANCE_DN">
 	    <function-arg-description>
 		  Directory Manager DN			
@@ -171,7 +275,9 @@
 	  <message>
 	    'Create instance in host %s at directory %s' % (dsHost,dsDir)
 	  </message>
+		
 
+      <!-- ON REMOTE HOST: copy files, unzip, configure instance -->
       <!--- Delete folder if it exists on remote host-->
       <message>
         'Delete folder %s/%s on host %s' % (dsDir,OPENDSNAME,dsHost)
@@ -237,7 +343,8 @@
       <call function="'ConfigureDsWithScript'">
         { 'location' : dsHost, 
 		  'dsPath' : '%s/%s' % (dsDir, OPENDSNAME),
-		  'dsPort'   : dsPort ,
+		  'dsPort'   : dsPort,
+          'dsJmxPort' : dsJmxPort,		  
 		  'dsBindDN' : dsBindDN,
 		  'dsBindPwd' : dsBindPwd,
           'dsBaseDN' : dsBaseDN }
@@ -258,7 +365,8 @@
 		  </message>
 		</else>  
 	  </if>      
-				
+					
+			
 	</sequence> 
 	  
   </function>
@@ -311,52 +419,56 @@
 		
 	  <script>
         remoteFilePath = '%s/%s' % (dataDir, filename)
-        configPath = '%s/%s/config/config.ldif' % (syncserver.getDir(),OPENDSNAME)
+        syncserverPath = '%s/%s' % (syncserver.getDir(),OPENDSNAME)
 	  </script>
-
-	  <stafcmd>
-	    <location> syncserver.getHostname() </location>
-		<service> 'FS' </service>
-		<request> 'GET ENTRY %s SIZE' % configPath </request>		  
-	  </stafcmd>
-
-	  <script>
-        if RC == STAFRC.Ok:
-          configFileSize = STAFResult['lowerSize']
-        
-        cmd = '/bin/dd'
-        
-        cmdParamsList = []
-        cmdParamsList.append('if=%s' % remoteFilePath)
-        cmdParamsList.append('of=%s' % configPath)
-        cmdParamsList.append('conv=notrunc bs=1 seek=%s' % configFileSize)		  
-        cmdParams = ' '.join(cmdParamsList)
-	  </script>
-
-      <message>
-	    'Append %s to %s' % (remoteFilePath,configPath)
-	  </message>
-	  <message>
-		 '%s %s' % (cmd,cmdParams)
-	  </message>
-								  
-	  <process name="'Append Synchronization Entries to config.ldif'">
-	    <location> syncserver.getHostname() </location>
-		<command> '%s' % cmd </command>
-		<parms>'%s' % cmdParams </parms>
-		<workdir> '/bin' </workdir>
-		<envs>
-		  ['PATH=/bin:/usr/bin', 'JAVA_HOME=%s' % (JAVA_HOME)]
-		</envs>
-		<stderr mode="'stdout'"/>
-		<returnstdout/>
-	  </process>				  		
 		
+		
+      <!--- Start DS -->				         
+      <call function="'StartDsWithScript'">
+        { 'location'  : syncserver.getHostname(),
+           'dsPath' : syncserverPath }
+      </call>
+      
       <call function="'checkRC'">
         { 'returncode' : RC ,
           'result'     : STAXResult }
+      </call>		
+
+      <message>
+	    'Add synchronization configuration entries in %s' % remoteFilePath
+	  </message>
+						
+	  <call function="'addEntry'">
+        { 'location' : syncserver.getHostname(),
+          'dsPath' : syncserverPath,
+          'dsInstanceHost'    : syncserver.getHostname(),
+          'dsInstancePort'   : syncserver.getPort(),
+          'dsInstanceDn'    : syncserver.getRootDn(),
+          'dsInstancePswd'  : syncserver.getRootPwd(),
+          'entryToBeAdded'   : remoteFilePath }
       </call>
-        
+    
+      <call function="'checkRC'">
+        { 'returncode' : RC,
+          'result'     : STAXResult }
+      </call>			
+
+
+      <!--- Stop DS -->					      
+      <call function="'StopDsWithScript'">
+        { 'location'  : syncserver.getHostname(),
+          'dsHost' : syncserver.getHostname(),
+          'dsPath' : syncserverPath,
+          'dsPort'    : syncserver.getPort(),
+          'dsBindDN'  : syncserver.getRootDn(),
+          'dsBindPwd' : syncserver.getRootPwd() }
+      </call>
+      
+      <call function="'checkRC'">
+        { 'returncode' : RC ,
+          'result'     : STAXResult }
+      </call>							
+
 		
 	</sequence>	
 	  
@@ -397,6 +509,7 @@
         dir = None
         port = None
         sslport = None
+        jmxport = None		  
         rootDn = None
         rootPwd = None
         baseDn = None
@@ -418,6 +531,8 @@
             port = line[line.find('Port') + 5:].strip()
           elif line.find('Sslport') != -1:
             sslport = line[line.find('Sslport') + 8:].strip()
+          elif line.find('Jmxport') != -1:
+            jmxport = line[line.find('Jmxport') + 8:].strip()		  
           elif line.find('RootDn') != -1:
             rootDn = line[line.find('RootDn') + 7:].strip()
           elif line.find('RootPwd') != -1:
@@ -431,7 +546,7 @@
           elif line.find('ChangelogServer') != -1:
             changelogList.append( line[line.find('ChangelogServer') + 16:].strip() )
           elif (line.isspace()) or (len(line) == 0):
-            server = Server(hostname, dir, port, sslport, rootDn, rootPwd, baseDn)
+            server = Server(hostname, dir, port, sslport, jmxport, rootDn, rootPwd, baseDn)
             
             if changelogport != None:
               changelogServer = ChangelogServer(changelogport, serverId)
@@ -455,6 +570,7 @@
             dir = None
             port = None
             sslport = None
+            jmxport = None		  
             rootDn = None
             rootPwd = None
             baseDn = None
@@ -464,7 +580,7 @@
             serverId += 1
         
         if hostname != None:
-          server = Server(hostname, dir, port, sslport, rootDn, rootPwd, baseDn)
+          server = Server(hostname, dir, port, sslport, jmxport, rootDn, rootPwd, baseDn)
             
           if changelogport != None:
             changelogServer = ChangelogServer(changelogport, serverId)
@@ -492,71 +608,124 @@
 	  	  
   </function>	
 	
-
-  <function name="removeTopology">
+	
+	
+  <function name="removeInstance">
     <function-prolog>
-		This function removes the topology created for the Test Group/Suite.
-	</function-prolog>   	  
-
+		This function removes an instance on a given host.
+	</function-prolog>
+	
+	<function-map-args>
+	  <function-arg-def name="dsHost" type="optional" default="DIRECTORY_INSTANCE_HOST">
+	    <function-arg-description>
+		  Hostname where the instance is to be created			
+		</function-arg-description>	
+        <function-arg-property name="type" value="hostname"/>
+	  </function-arg-def>
+	  <function-arg-def name="dsDir" type="optional" default="DIRECTORY_INSTANCE_DIR">
+	    <function-arg-description>
+		  Directory where OpenDS will be installed			
+		</function-arg-description>
+        <function-arg-property name="type" value="filepath"/>
+      </function-arg-def>
+	</function-map-args>
+	  	  
 	  
-	<sequence>
+    <sequence>
+		
+	  <message>
+	    'Removing instance %s/%s on host %s' % (dsDir,OPENDSNAME,dsHost)
+	  </message>
+		
 
-      <message>
-	    'Number of server instances deployed: %s' % len(_topologyServerList)
-	  </message>			  
-			  
-	  <iterate var="server" in="_topologyServerList">
-	    <sequence>
-
-		  <message>
-		    'Cleaning up %s/%s instance on host %s' % (server.getDir(),OPENDSNAME,server.getHostname())
-		  </message>
-						
+      <!-- ON REMOTE HOST: remove files and folders -->
           <!--- Delete staging data file on remote host-->
           <message>
-            'Delete stagingn data file %s/ldifdata.zip' % server.getDir()
+            'Delete staging data file %s/ldifdata.zip' % dsDir
           </message>
           <call function="'deleteFile'">
-            { 'location' : server.getHostname(),
-              'filename' : '%s/ldifdata.zip' % server.getDir() }
+            { 'location' : dsHost,
+              'filename' : '%s/ldifdata.zip' % dsDir }
           </call>
     
           <!--- Delete staging data folder on remote host -->
           <message>
-            'Delete staging data folder %s/functional-tests' % server.getDir()
+            'Delete staging data folder %s/functional-tests' % dsDir
           </message>
           <call function="'deleteFolder'">
-            { 'location'   : server.getHostname(),
-              'foldername' : '%s/functional-tests' % server.getDir() }
+            { 'location'   : dsHost,
+              'foldername' : '%s/functional-tests' % dsDir }
           </call>
 			
-			
-          <!--- Delete OPENDS folder on remote host-->
-          <message>
-            'Delete OPENDS folder %s/%s' % (server.getDir(),OPENDSNAME)
-          </message>
-          <call function="'deleteFolder'">
-            { 'location' : server.getHostname(), 
-    		  'foldername' : '%s/%s' % (server.getDir(),OPENDSNAME) }
-          </call>			
-			
+
+								
           <!--- Delete OPENDS zip file on remote host-->
           <message>
             'Delete OPENDS zip file %s' % DSTFILE
           </message>
           <call function="'deleteFile'">
-            { 'location' : server.getHostname(), 
+            { 'location' : dsHost, 
     		  'filename' : '%s' % DSTFILE }
           </call>						
-			    	
+		
+		
+      <call function="'checkRC'">
+        { 'returncode' : RC ,
+          'result'     : STAXResult }
+      </call>
+
+      <if expr="returncode == 0">
+	    <message>
+	      'Instance removed.'
+	    </message>
+		<else>
 		  <message>
-		    'Instance cleaned up.'
-		  </message>			
-			
-		</sequence>				
-	  </iterate>
-			  
+			  'Failed to remove instance.'
+		  </message>
+		</else>  
+	  </if>      
 				
+	</sequence> 
+	  
+  </function>
+
+
+	
+	
+  <function name="removeTopology">
+    <function-prolog>
+		This function removes the topology created for the Test Group/Suite.
+	</function-prolog>   	  
+	<function-map-args>
+	  <function-arg-def name="multipleInstanceTopology" type="optional" default="False">
+	    <function-arg-description>
+		  Tells whether it is a single (i.e. parameters read from config.py) or
+		  a multiple-instance topology (i.e. parameters read from topology desc file).
+		</function-arg-description>
+		<function-arg-property name="type" value="boolean"/>			
+	  </function-arg-def>	
+	</function-map-args>
+	  
+	<sequence>
+		
+	  <if expr="multipleInstanceTopology == False">	
+		  <!-- SINGLE instance deployment: parameters read from config.py (done by default) -->
+			  
+		  <call function="'removeInstance'"></call>
+	  		  
+	  <else>
+		<!-- MULTIPLE instance deployment: parameters read from topologyDescFile -->
+	    <iterate var="server" in="_topologyServerList">
+						
+          <call function="'removeInstance'">
+		    { 'dsHost' : server.getHostname(),
+			  'dsDir' : server.getDir() }	  
+		  </call>
+			
+ 	    </iterate>
+	  </else>
+	  </if>
+		  
 	</sequence>  
 	    
   </function>
diff --git a/opends/tests/functional-tests/testcases/runFuncTests.xml b/opends/tests/functional-tests/testcases/runFuncTests.xml
index 4723887..0a7d798 100755
--- a/opends/tests/functional-tests/testcases/runFuncTests.xml
+++ b/opends/tests/functional-tests/testcases/runFuncTests.xml
@@ -32,91 +32,17 @@
   <function name="main">
 
     <sequence>
-
-      <!--- Import all the shared xml libraries -->
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/utils.xml' % (TESTS_FUNCTIONS_DIR)" />
-
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/stafcmd.xml' % (TESTS_FUNCTIONS_DIR)" />
-
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/staxcmd.xml' % (TESTS_FUNCTIONS_DIR)" />
-
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/dsadm.xml' % (TESTS_FUNCTIONS_DIR)" />
-
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/ldap.xml' % (TESTS_FUNCTIONS_DIR)" />
-
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/security.xml' % (TESTS_FUNCTIONS_DIR)" />
 		
-	  <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/topology.xml' % (TESTS_FUNCTIONS_DIR)" />
-        
+      <!--- Load the environment for the test suite execution -->
       <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/signals.xml' % (TESTS_FUNCTIONS_DIR)" />
+        file="'%s/environment.xml' % (TESTS_FUNCTIONS_DIR)" />
+      <call function="'loadEnvironment'" />  
 
-      <!-- Load in any standard python libraries -->
-      <script>
-        import re
-        import posixpath
-        import sys
-      </script>
-
-      <!-- Load in any standard python functions -->
-      <script>
-        from time import localtime,strftime
-      </script> 
-
-      <!-- Resolve any OS related variables -->           
-      <call function="'setOSvariables'">
-        { 'hostname' : STAF_REMOTE_HOSTNAME }
-      </call>
-
-      <!-- XXXX this needs some cleanup XXXX -->
-      <script>
-        STAXLogMessage = 1 
-        LogDir='%s' % TMPDIR
-        SRCFILE = '%s/%s' % (ZIPPATH,ZIPNAME) 
-        DSTFILE = '%s/%s' % (TMPDIR,ZIPNAME)
-        OPENDS_BINPATH ='%s/%s/bin' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME) 
-        OSName= STAXResult
-        winPattern=re.compile('win', re.IGNORECASE)
-        isWindows=winPattern.search(OSName)
-        if isWindows:
-          fileExt='.bat'
-          fileFolder='bat'
-        else:
-          fileExt=''
-          fileFolder='bin'
-      </script>
-      
-      <!-- Load in the local shared python objects from libraries -->
-      <script>
-        sys.path.append("%s/python" % TESTS_SHARED_DIR )
-        from common import *
-      </script>     
-
-      <!-- Set the signal handlers -->          
-      <call function="'signals'"/>
-      
-      <!-- Initialize any global variables -->
-      <script>
-        CurrentTestPath={}
-      </script>
-
+		
+		
       <!--- The Functional Tests -->		
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/testcases/setup/setup.xml' % (TESTS_DIR)" />
-      <call function="'main_setup'" />
 		
       <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/testcases/quickstart/quickstart.xml' % (TESTS_DIR)" />
-      <call function="'main_quickstart'" />
-
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
         file="'%s/testcases/security/security.xml' % (TESTS_DIR)" />
       <call function="'main_security'" />
 
@@ -135,19 +61,13 @@
       <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
         file="'%s/testcases/schema/schema.xml' % (TESTS_DIR)" />
       <call function="'main_schema'" />
-		
-      <if expr="not isWindows">
-	  <sequence>		
+
 	  <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
         file="'%s/testcases/synchronization/synchronization.xml' % (TESTS_DIR)" />
       <call function="'main_synchronization'" />		
-	  </sequence>	  	  
-      </if>			
 
-      <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-        file="'%s/testcases/cleanup/cleanup.xml' % (TESTS_DIR)" />
-      <call function="'main_cleanup'" />
-		
+			
+
     </sequence>
   </function>
 </stax>
diff --git a/opends/tests/functional-tests/testcases/schema/schema.xml b/opends/tests/functional-tests/testcases/schema/schema.xml
index b90ad95..6d98227 100644
--- a/opends/tests/functional-tests/testcases/schema/schema.xml
+++ b/opends/tests/functional-tests/testcases/schema/schema.xml
@@ -42,32 +42,11 @@
           </script>
           
           <call function="'testGroup_Preamble'"/>
-    
-          <!--- Start DS -->
-          <message>
-            'Start DS to run on port %s' % DIRECTORY_INSTANCE_PORT
-          </message>
-
-          <!--- Start DS -->
-          <call function="'StartDsWithScript'">
-           { 'location'  : STAF_REMOTE_HOSTNAME }
-          </call>
-
-          <call function="'checkRC'">
-            { 'returncode' : RC , 'result' : STAXResult }
-          </call>
-
-          <!--- Check that DS started -->
-          <call function="'isAlive'">
-            { 'noOfLoops' : 5 , 'noOfMilliSeconds' : 2000 }
-          </call>
+			
+			
 
           <!-- Call the test suites -->
           <import machine="'%s' % STAF_LOCAL_HOSTNAME"
-            file="'%s/testcases/schema/schema_setup.xml' % TESTS_DIR" />
-          <call function="'schema_setup'" />
-
-          <import machine="'%s' % STAF_LOCAL_HOSTNAME"
             file="'%s/testcases/schema/schema_rfc_tests.xml' % TESTS_DIR" />
           <call function="'schema_rfc_tests'" />
           
@@ -75,24 +54,8 @@
             file="'%s/testcases/schema/schema_dynamic.xml' % TESTS_DIR" />
           <call function="'schema-dynamic'" />
 
-          <!--- Stop DS -->
-          <message>
-            'Stop DS running on port %s' % DIRECTORY_INSTANCE_PORT
-          </message>
-
-          <call function="'StopDsWithScript'">
-              { 'location'  : STAF_REMOTE_HOSTNAME,
-                'dsHost'    : DIRECTORY_INSTANCE_HOST,
-                'dsPort'    : DIRECTORY_INSTANCE_PORT,
-                'dsBindDN'  : DIRECTORY_INSTANCE_DN,
-                'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
-          </call>
-
-          <call function="'checkRC'">
-            { 'returncode' : RC , 
-              'result'     : STAXResult }
-          </call>
-              
+					
+						              
           <call function="'testGroup_Postamble'"/>
 
         </sequence>
diff --git a/opends/tests/functional-tests/testcases/schema/schema_cleanup.xml b/opends/tests/functional-tests/testcases/schema/schema_cleanup.xml
new file mode 100755
index 0000000..55b4cc2
--- /dev/null
+++ b/opends/tests/functional-tests/testcases/schema/schema_cleanup.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE stax SYSTEM "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 2007 Sun Microsystems, Inc.
+ ! -->
+<stax>
+
+  <defaultcall function="schema_cleanup"/>
+
+  <function name="schema_cleanup">
+
+    <sequence>
+
+      <block name="'cleanup'">
+      
+        <sequence>
+
+			
+          <block name="'Block DS Process Stop'">				
+          <!--- Stop DS -->
+		    <sequence>
+              <message>
+                 'Stop DS running on port %s' % (DIRECTORY_INSTANCE_PORT)
+              </message>
+
+              <call function="'StopDsWithScript'">
+                { 'location'  : STAF_REMOTE_HOSTNAME,
+                  'dsHost'    : DIRECTORY_INSTANCE_HOST,
+                  'dsPort'    : DIRECTORY_INSTANCE_PORT,
+                  'dsBindDN'  : DIRECTORY_INSTANCE_DN,
+                  'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
+              </call>
+
+              <call function="'checkRC'">
+                  { 'returncode' : RC ,
+                    'result'     : STAXResult }
+              </call>
+
+		    </sequence>			  
+          <!--- End Block DS Process Stop -->
+          </block>
+			
+						  			  			  
+
+		  <block name="'Block Remove DS Topology'">
+		  <!-- Remove  the topology created for the test suite -->
+			<sequence>
+				
+              <message>
+                 'Remove DS topology created for the Test Suite'
+              </message>				  
+
+			  <call function="'removeTopology'"/>
+				
+			  <call function="'checkRC'">
+                  { 'returncode' : RC ,
+                    'result'     : STAXResult }
+              </call>
+			
+			</sequence>			  
+		  <!-- End Block Remove DS Topology-->  
+		  </block>	  														  
+			        
+			
+        </sequence>        
+      </block>
+            
+     </sequence>
+
+  </function>
+
+</stax>
diff --git a/opends/tests/functional-tests/testcases/schema/schema_dynamic.xml b/opends/tests/functional-tests/testcases/schema/schema_dynamic.xml
index 681f529..56157f2 100644
--- a/opends/tests/functional-tests/testcases/schema/schema_dynamic.xml
+++ b/opends/tests/functional-tests/testcases/schema/schema_dynamic.xml
@@ -39,6 +39,8 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='schema'								  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
       
@@ -54,7 +56,13 @@
               #@TestSuiteGroup            Dynamic Schema Tests
               #@TestScript                schema_dynamic.xml
         -->
-  
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/schema/schema_setup.xml' % (TESTS_DIR)"/>
+          <call function="'schema_setup'"/>
+
+												  
          <!--- Test case: Update Schema via a file -->
          <!---
               Place test-specific test information here.
@@ -348,7 +356,13 @@
             <call function="'testCase_Postamble'"/>
           </sequence>
         </testcase>
-        
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/schema/schema_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'schema_cleanup'"/>
+
+												        
         <call function="'testSuite_Postamble'"/>
       
         </sequence>
diff --git a/opends/tests/functional-tests/testcases/schema/schema_rfc_tests.xml b/opends/tests/functional-tests/testcases/schema/schema_rfc_tests.xml
index 92ba0d1..4e289b0 100644
--- a/opends/tests/functional-tests/testcases/schema/schema_rfc_tests.xml
+++ b/opends/tests/functional-tests/testcases/schema/schema_rfc_tests.xml
@@ -38,16 +38,18 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='schema'								  			  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
             
           <call function="'testSuite_Preamble'"/>
-      
-          <!--- Check that DS started -->
-          <call function="'isAlive'">
-            { 'noOfLoops'        : 5 ,
-              'noOfMilliSeconds' : 2000 }
-          </call>
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/schema/schema_setup.xml' % (TESTS_DIR)"/>
+          <call function="'schema_setup'"/>
+									      
          
           <!--- Test Case : Schema RFC Test 2079 -->
           <testcase name="'Core: Schema: RFC 2079'">
@@ -1051,7 +1053,13 @@
             <call function="'testCase_Postamble'"/>
           </sequence>
         </testcase>
-    
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/schema/schema_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'schema_cleanup'"/>
+
+												    
         <call function="'testSuite_Postamble'"/>
         
         </sequence>
diff --git a/opends/tests/functional-tests/testcases/schema/schema_setup.xml b/opends/tests/functional-tests/testcases/schema/schema_setup.xml
index fca9986..d481d72 100644
--- a/opends/tests/functional-tests/testcases/schema/schema_setup.xml
+++ b/opends/tests/functional-tests/testcases/schema/schema_setup.xml
@@ -23,7 +23,7 @@
  !
  ! CDDL HEADER END
  !
- !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
 <stax>
 
@@ -36,23 +36,63 @@
       <block name="'setup'">
       
         <sequence>
+						  
+				  
+		  <block name="'Block Create DS Topology'">
+		  <!-- Create the topology necessary to the test group/suite -->
+		    <sequence>
+								
+              <message>
+                 'Create DS topology as described in config.py'
+              </message>
+				  
+			  <call function="'createTopology'">
+			    { 'initialiseInstance' : True }
+			  </call>
+				    				
+			  <call function="'checkRC'">
+                  { 'returncode' : RC ,
+                    'result'     : STAXResult }
+              </call>
+      
+            </sequence>      
+          <!--- End Block Create DS Topology -->	
+          </block>				  				  
+
+
+		  <block name="'Block DS Process Active'">	  	
+          <!--- Start DS -->
+		    <sequence>
+				
+              <message>
+                 'Start DS to run on port %s' % (DIRECTORY_INSTANCE_PORT)
+              </message>
   
-          <script>
-            CurrentTestPath['suite']=STAXCurrentBlock
-          </script>
-            
-          <call function="'testSuite_Preamble'"/>
-    
-          <!--- Check that DS started -->
-          <call function="'isAlive'">
-            { 'noOfLoops'        : 5 ,
-              'noOfMilliSeconds' : 2000 }
-          </call>
-    
-            <!--- Test Case : Add required entries -->
-          <testcase name="'Core: Schema: Add required entries'">
-            <sequence>
-              <call function="'testCase_Preamble'"/>
+              <!--- Start DS -->
+              <call function="'StartDsWithScript'">
+               { 'location'  : STAF_REMOTE_HOSTNAME }
+              </call>
+  
+              <call function="'checkRC'">
+                  { 'returncode' : RC ,
+                    'result'     : STAXResult }
+              </call>
+  
+              <!--- Check that DS started -->
+              <call function="'isAlive'">
+                { 'noOfLoops'        : 5 ,
+                  'noOfMilliSeconds' : 2000 }
+              </call>			
+				
+            </sequence>
+          <!--- End Block DS Process Active -->
+          </block>			  			
+						
+
+          <block name="'Block DS Load Data'">
+		  <!-- Load the data needed by the test suite -->			
+	        <sequence>
+
               <message>
                  'Add entries that are required for the Schema Tests'
               </message>
@@ -65,21 +105,20 @@
                   'entryToBeAdded'   : '%s/schema/ldifs/schema_start.ldif' % STAGED_DATA_DIR }
               </call>
     
-              <call function="'checktestRC'">
+              <call function="'checkRC'">
                   { 'returncode' : RC ,
                     'result'     : STAXResult }
               </call>
-              <call function="'testCase_Postamble'"/>
-            </sequence>
-          </testcase>
-          
-          <call function="'testSuite_Postamble'"/>
 
-        </sequence>
-    
+																							
+			</sequence>
+          <!-- End Block DS Load Data -->			  										  				  
+          </block>
+			        
+        </sequence>        
       </block>
-    
-    </sequence>
+            
+     </sequence>
 
   </function>
 
diff --git a/opends/tests/functional-tests/testcases/security/account_activation/security_account_activation.xml b/opends/tests/functional-tests/testcases/security/account_activation/security_account_activation.xml
index 10bc38b..959c372 100755
--- a/opends/tests/functional-tests/testcases/security/account_activation/security_account_activation.xml
+++ b/opends/tests/functional-tests/testcases/security/account_activation/security_account_activation.xml
@@ -38,31 +38,19 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='security'								  							  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
 
           <call function="'testSuite_Preamble'"/>
-          
-          <!--- Start DS -->
-          <message>
-             'Start DS to run on port %s' % DIRECTORY_INSTANCE_PORT
-          </message>
-  
-          <!--- Start DS -->
-          <call function="'StartDsWithScript'">
-           { 'location'  : STAF_REMOTE_HOSTNAME }
-          </call>
-  
-          <call function="'checkRC'">
-              { 'returncode' : RC ,
-                'result'     : STAXResult }
-          </call>
-  
-          <!--- Check that DS started -->
-          <call function="'isAlive'">
-            { 'noOfLoops'        : 5 ,
-              'noOfMilliSeconds' : 2000 }
-          </call>
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_setup.xml' % (TESTS_DIR)"/>
+          <call function="'security_setup'"/>
+
+												          
   
           <import machine="'%s' % STAF_LOCAL_HOSTNAME"
             file="'%s/testcases/security/account_activation/security_setup_account_activation.xml' % (TESTS_DIR)"/>
@@ -79,27 +67,14 @@
           <import machine="'%s' % STAF_LOCAL_HOSTNAME"
             file="'%s/testcases/security/account_activation/security_teardown_account_activation.xml' % (TESTS_DIR)"/>
           <call function="'teardown_account_activation'" />
-  
-          <!--- Stop DS -->
 
-            <message>
-               'Stop DS running on port %s' % DIRECTORY_INSTANCE_PORT
-            </message>
-  
-            <call function="'StopDsWithScript'">
-                { 'location'  : STAF_REMOTE_HOSTNAME,
-                  'dsHost'    : DIRECTORY_INSTANCE_HOST,
-                  'dsPort'    : DIRECTORY_INSTANCE_PORT,
-                  'dsBindDN'  : DIRECTORY_INSTANCE_DN,
-                  'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
-            </call>
-  
-            <call function="'checkRC'">
-                { 'returncode' : RC ,
-                  'result'     : STAXResult }
-            </call>
+			
 
-  
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'security_cleanup'"/>
+
+									  
           <call function="'testSuite_Postamble'"/>
         
         </sequence>
diff --git a/opends/tests/functional-tests/testcases/security/auth_pwd_syntax/security_auth_pwd_syntax.xml b/opends/tests/functional-tests/testcases/security/auth_pwd_syntax/security_auth_pwd_syntax.xml
index ef293e0..b0b0bc8 100755
--- a/opends/tests/functional-tests/testcases/security/auth_pwd_syntax/security_auth_pwd_syntax.xml
+++ b/opends/tests/functional-tests/testcases/security/auth_pwd_syntax/security_auth_pwd_syntax.xml
@@ -38,32 +38,19 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='security'								  							  			  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
         
           <call function="'testSuite_Preamble'"/>
-          
-          <!--- Start DS -->
-          <message>
-             'Start DS to run on port %s' % DIRECTORY_INSTANCE_PORT
-          </message>
-  
-          <!--- Start DS -->
-          <call function="'StartDsWithScript'">
-           { 'location'  : STAF_REMOTE_HOSTNAME }
-          </call>
-  
-          <call function="'checkRC'">
-              { 'returncode' : RC ,
-                'result'     : STAXResult }
-          </call>
-    
-          <!--- Check that DS started -->
-          <call function="'isAlive'">
-            { 'noOfLoops'        : 5 ,
-              'noOfMilliSeconds' : 2000 }
-          </call>
-  
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_setup.xml' % (TESTS_DIR)"/>
+          <call function="'security_setup'"/>
+												          
+
           <import machine="'%s' % STAF_LOCAL_HOSTNAME"
             file="'%s/testcases/security/auth_pwd_syntax/security_setup_auth_pwd_syntax.xml' % (TESTS_DIR)"/>
           <call function="'setup_auth_pwd_syntax'" />
@@ -96,24 +83,13 @@
             file="'%s/testcases/security/auth_pwd_syntax/security_teardown_auth_pwd_syntax.xml' % (TESTS_DIR)"/>
           <call function="'teardown_auth_pwd_syntax'" />
   
-          <!--- Stop DS -->
-          <message>
-             'Stop DS running on port %s' % DIRECTORY_INSTANCE_PORT
-          </message>
 
-          <call function="'StopDsWithScript'">
-              { 'location'  : STAF_REMOTE_HOSTNAME,
-                'dsHost'    : DIRECTORY_INSTANCE_HOST,
-                'dsPort'    : DIRECTORY_INSTANCE_PORT,
-                'dsBindDN'  : DIRECTORY_INSTANCE_DN,
-                'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
-          </call>
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'security_cleanup'"/>
 
-          <call function="'checkRC'">
-              { 'returncode' : RC ,
-                'result'     : STAXResult }
-          </call>
 
+												
           <call function="'testSuite_Postamble'"/>
         
         </sequence>
diff --git a/opends/tests/functional-tests/testcases/security/bind_no_pwd/security_bind_no_pwd.xml b/opends/tests/functional-tests/testcases/security/bind_no_pwd/security_bind_no_pwd.xml
index 8a30e02..f774029 100755
--- a/opends/tests/functional-tests/testcases/security/bind_no_pwd/security_bind_no_pwd.xml
+++ b/opends/tests/functional-tests/testcases/security/bind_no_pwd/security_bind_no_pwd.xml
@@ -38,32 +38,20 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='security'								  							  			  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
               
           <call function="'testSuite_Preamble'"/>
-          
-          <!--- Start DS -->
-          <message>
-             'Start DS to run on port %s' % DIRECTORY_INSTANCE_PORT
-          </message>
-  
-          <!--- Start DS -->
-          <call function="'StartDsWithScript'">
-           { 'location'  : STAF_REMOTE_HOSTNAME }
-          </call>
-  
-          <call function="'checkRC'">
-              { 'returncode' : RC ,
-                'result'     : STAXResult }
-          </call>
-    
-          <!--- Check that DS started -->
-          <call function="'isAlive'">
-            { 'noOfLoops'        : 5 ,
-              'noOfMilliSeconds' : 2000 }
-          </call>
-  
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_setup.xml' % (TESTS_DIR)"/>
+          <call function="'security_setup'"/>
+
+
+			  
           <import machine="'%s' % STAF_LOCAL_HOSTNAME"
             file="'%s/testcases/security/bind_no_pwd/security_setup_bind_no_pwd.xml' % (TESTS_DIR)"/>
           <call function="'setup_bind_no_pwd'" />
@@ -75,25 +63,13 @@
           <import machine="'%s' % STAF_LOCAL_HOSTNAME"
             file="'%s/testcases/security/bind_no_pwd/security_teardown_bind_no_pwd.xml' % (TESTS_DIR)"/>
           <call function="'teardown_bind_no_pwd'" />
-  
-          <!--- Stop DS -->
-          <message>
-             'Stop DS running on port %s' % DIRECTORY_INSTANCE_PORT
-          </message>
 
-          <call function="'StopDsWithScript'">
-              { 'location'  : STAF_REMOTE_HOSTNAME,
-                'dsHost'    : DIRECTORY_INSTANCE_HOST,
-                'dsPort'    : DIRECTORY_INSTANCE_PORT,
-                'dsBindDN'  : DIRECTORY_INSTANCE_DN,
-                'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
-          </call>
 
-          <call function="'checkRC'">
-              { 'returncode' : RC ,
-                'result'     : STAXResult }
-          </call>
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'security_cleanup'"/>
 
+												
           <call function="'testSuite_Postamble'"/>
         
         </sequence>
diff --git a/opends/tests/functional-tests/testcases/security/jks/security_jks.xml b/opends/tests/functional-tests/testcases/security/jks/security_jks.xml
index 4aa6fe3..a1a4fbd 100755
--- a/opends/tests/functional-tests/testcases/security/jks/security_jks.xml
+++ b/opends/tests/functional-tests/testcases/security/jks/security_jks.xml
@@ -38,32 +38,20 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='security'								  							  			  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
        
           <call function="'testSuite_Preamble'"/>
-    
-          <!-- Start DS -->
-          <message>
-             'Start DS to run on port %s' % DIRECTORY_INSTANCE_PORT
-          </message>
-  
-          <!-- Start DS -->
-          <call function="'StartDsWithScript'">
-           { 'location'  : STAF_REMOTE_HOSTNAME }
-          </call>
-  
-          <call function="'checkRC'">
-              { 'returncode' : RC ,
-                'result'     : STAXResult }
-          </call>
-  
-          <!-- Check that DS started -->
-          <call function="'isAlive'">
-            { 'noOfLoops'        : 5 ,
-              'noOfMilliSeconds' : 2000 }
-          </call>
-  
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_setup.xml' % (TESTS_DIR)"/>
+          <call function="'security_setup'"/>
+
+															
+     
           <import machine="'%s' % STAF_LOCAL_HOSTNAME"
             file="'%s/testcases/security/jks/security_setup_jks.xml' % (TESTS_DIR)"/>
           <call function="'setup_jks'" />
@@ -76,23 +64,13 @@
             file="'%s/testcases/security/jks/security_teardown_jks.xml' % (TESTS_DIR)"/>
           <call function="'teardown_jks'" />
   
-          <!-- Stop DS -->
-          <message>
-             'Stop DS running on port %s' % DIRECTORY_INSTANCE_PORT
-          </message>
 
-          <call function="'StopDsWithScript'">
-              { 'location'  : STAF_REMOTE_HOSTNAME,
-                'dsHost'    : DIRECTORY_INSTANCE_HOST,
-                'dsPort'    : DIRECTORY_INSTANCE_PORT,
-                'dsBindDN'  : DIRECTORY_INSTANCE_DN,
-                'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
-          </call>
 
-          <call function="'checkRC'">
-              { 'returncode' : RC ,
-                'result'     : STAXResult }
-          </call>
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'security_cleanup'"/>
+
+												
     
           <call function="'testSuite_Postamble'"/>
 
diff --git a/opends/tests/functional-tests/testcases/security/jks/security_setup_jks.xml b/opends/tests/functional-tests/testcases/security/jks/security_setup_jks.xml
index afbf37a..2e81781 100755
--- a/opends/tests/functional-tests/testcases/security/jks/security_setup_jks.xml
+++ b/opends/tests/functional-tests/testcases/security/jks/security_setup_jks.xml
@@ -78,7 +78,7 @@
 
             <!--- Self-Sign Server Cert -->
             <message>
-               'Security: JKS: Preamble Step 2. Self-Signing Server Certicate'
+               'Security: JKS: Preamble Step 2. Self-Signing Server Certificate'
             </message>
 
             <call function="'selfSignServerJKSCert'">
diff --git a/opends/tests/functional-tests/testcases/security/pkcs12/security_pkcs12.xml b/opends/tests/functional-tests/testcases/security/pkcs12/security_pkcs12.xml
index c30c5bf..dea18f2 100755
--- a/opends/tests/functional-tests/testcases/security/pkcs12/security_pkcs12.xml
+++ b/opends/tests/functional-tests/testcases/security/pkcs12/security_pkcs12.xml
@@ -38,31 +38,19 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='security'								  							  			  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
             
           <call function="'testSuite_Preamble'"/>
- 
-          <!--- Start DS -->
-          <message>
-             'Start DS to run on port %s' % (DIRECTORY_INSTANCE_PORT)
-          </message>
-  
-          <!--- Start DS -->
-          <call function="'StartDsWithScript'">
-           { 'location'  : STAF_REMOTE_HOSTNAME }
-          </call>
-  
-          <call function="'checkRC'">
-              { 'returncode' : RC ,
-                'result'     : STAXResult }
-          </call>
 
-          <!--- Check that DS started -->
-          <call function="'isAlive'">
-            { 'noOfLoops'        : 5 ,
-              'noOfMilliSeconds' : 2000 }
-          </call>
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_setup.xml' % (TESTS_DIR)"/>
+          <call function="'security_setup'"/>
+
+												 
   
           <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
             file="'%s/testcases/security/pkcs12/security_setup_pkcs12.xml' % (TESTS_DIR)"/>
@@ -75,25 +63,14 @@
           <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
             file="'%s/testcases/security/pkcs12/security_teardown_pkcs12.xml' % (TESTS_DIR)"/>
           <call function="'teardown_pkcs12'" />
-  
-          <!--- Stop DS -->
-          <message>
-             'Stop DS running on port %s' % (DIRECTORY_INSTANCE_PORT)
-          </message>
 
-          <call function="'StopDsWithScript'">
-              { 'location'  : STAF_REMOTE_HOSTNAME,
-                'dsHost'    : DIRECTORY_INSTANCE_HOST,
-                'dsPort'    : DIRECTORY_INSTANCE_PORT,
-                'dsBindDN'  : DIRECTORY_INSTANCE_DN,
-                'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
-          </call>
 
-          <call function="'checkRC'">
-              { 'returncode' : RC ,
-                'result'     : STAXResult }
-          </call>
-  
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'security_cleanup'"/>
+
+												  
           <call function="'testSuite_Postamble'"/>
     
         </sequence>
diff --git a/opends/tests/functional-tests/testcases/security/pwd_policy/security_pwd_policy.xml b/opends/tests/functional-tests/testcases/security/pwd_policy/security_pwd_policy.xml
index 0769915..fa96d3e 100755
--- a/opends/tests/functional-tests/testcases/security/pwd_policy/security_pwd_policy.xml
+++ b/opends/tests/functional-tests/testcases/security/pwd_policy/security_pwd_policy.xml
@@ -38,32 +38,20 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='security'								  							  			  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
       
           <call function="'testSuite_Preamble'"/>
-              
-          <!--- Start DS -->
-          <message>
-             'Start DS to run on port %s' % DIRECTORY_INSTANCE_PORT
-          </message>
-  
-          <!--- Start DS -->
-          <call function="'StartDsWithScript'">
-           { 'location'  : STAF_REMOTE_HOSTNAME }
-          </call>
-  
-          <call function="'checkRC'">
-              { 'returncode' : RC ,
-                'result'     : STAXResult }
-          </call>
-  
-          <!--- Check that DS started -->
-          <call function="'isAlive'">
-            { 'noOfLoops'        : 5 ,
-              'noOfMilliSeconds' : 2000 }
-          </call>
-  
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_setup.xml' % (TESTS_DIR)"/>
+          <call function="'security_setup'"/>
+
+												              
+
           <import machine="'%s' % STAF_LOCAL_HOSTNAME"
             file="'%s/testcases/security/pwd_policy/security_setup_pwd_policy.xml' % (TESTS_DIR)"/>
           <call function="'setup_pwd_policy'" />
@@ -116,23 +104,12 @@
             file="'%s/testcases/security/pwd_policy/security_teardown_pwd_policy.xml' % (TESTS_DIR)"/>
           <call function="'teardown_pwd_policy'" />
   
-          <!--- Stop DS -->
-          <message>
-             'Stop DS running on port %s' % DIRECTORY_INSTANCE_PORT
-          </message>
 
-          <call function="'StopDsWithScript'">
-              { 'location'  : STAF_REMOTE_HOSTNAME,
-                'dsHost'    : DIRECTORY_INSTANCE_HOST,
-                'dsPort'    : DIRECTORY_INSTANCE_PORT,
-                'dsBindDN'  : DIRECTORY_INSTANCE_DN,
-                'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
-          </call>
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'security_cleanup'"/>
 
-          <call function="'checkRC'">
-              { 'returncode' : RC ,
-                'result'     : STAXResult }
-          </call>
+									
     
           <call function="'testSuite_Postamble'"/>
     
diff --git a/opends/tests/functional-tests/testcases/security/pwd_policy_root/security_pwd_policy_root.xml b/opends/tests/functional-tests/testcases/security/pwd_policy_root/security_pwd_policy_root.xml
index c25e193..73080e7 100755
--- a/opends/tests/functional-tests/testcases/security/pwd_policy_root/security_pwd_policy_root.xml
+++ b/opends/tests/functional-tests/testcases/security/pwd_policy_root/security_pwd_policy_root.xml
@@ -38,54 +38,31 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='security'								  							  			  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
       
           <call function="'testSuite_Preamble'"/>
-   
-          <!--- Start DS -->
-          <message>
-             'Start DS to run on port %s' % DIRECTORY_INSTANCE_PORT
-          </message>
-  
-          <!--- Start DS -->
-          <call function="'StartDsWithScript'">
-           { 'location'  : STAF_REMOTE_HOSTNAME }
-          </call>
-  
-          <call function="'checkRC'">
-              { 'returncode' : RC ,
-                'result'     : STAXResult }
-          </call>
-  
-          <!--- Check that DS started -->
-          <call function="'isAlive'">
-            { 'noOfLoops'        : 5 ,
-              'noOfMilliSeconds' : 2000 }
-          </call>
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_setup.xml' % (TESTS_DIR)"/>
+          <call function="'security_setup'"/>
+
+
   
           <import machine="'%s' % STAF_LOCAL_HOSTNAME"
             file="'%s/testcases/security/pwd_policy_root/security_root_user_tests.xml' % (TESTS_DIR)"/>
           <call function="'root_user_tests'" />
-  
-          <!--- Stop DS -->
-          <message>
-             'Stop DS running on port %s' % DIRECTORY_INSTANCE_PORT
-          </message>
 
-          <call function="'StopDsWithScript'">
-              { 'location'  : STAF_REMOTE_HOSTNAME,
-                'dsHost'    : DIRECTORY_INSTANCE_HOST,
-                'dsPort'    : DIRECTORY_INSTANCE_PORT,
-                'dsBindDN'  : DIRECTORY_INSTANCE_DN,
-                'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
-          </call>
 
-          <call function="'checkRC'">
-              { 'returncode' : RC ,
-                'result'     : STAXResult }
-          </call>
-    
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'security_cleanup'"/>
+
+												    
           <call function="'testSuite_Postamble'"/>
     
         </sequence>
diff --git a/opends/tests/functional-tests/testcases/security/pwd_storage/security_pwd_storage.xml b/opends/tests/functional-tests/testcases/security/pwd_storage/security_pwd_storage.xml
index 2db095d..30f6138 100755
--- a/opends/tests/functional-tests/testcases/security/pwd_storage/security_pwd_storage.xml
+++ b/opends/tests/functional-tests/testcases/security/pwd_storage/security_pwd_storage.xml
@@ -38,32 +38,19 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='security'								  							  			  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
 
           <call function="'testSuite_Preamble'"/>
-        
-          <!-- Start DS -->
-          <message>
-             'Start DS to run on port %s' % (DIRECTORY_INSTANCE_PORT)
-          </message>
-  
-          <!--- Start DS -->
-          <call function="'StartDsWithScript'">
-           { 'location'  : STAF_REMOTE_HOSTNAME }
-          </call>
-  
-          <call function="'checkRC'">
-              { 'returncode' : RC ,
-                'result'     : STAXResult }
-          </call>
-      
-          <!--- Check that DS started -->
-          <call function="'isAlive'">
-            { 'noOfLoops'        : 5 ,
-              'noOfMilliSeconds' : 2000 }
-          </call>
-  
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_setup.xml' % (TESTS_DIR)"/>
+          <call function="'security_setup'"/>
+									        
+
           <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
             file="'%s/testcases/security/pwd_storage/security_setup_pwd_storage.xml' % (TESTS_DIR)"/>
           <call function="'setup_pwd_storage'" />
@@ -115,25 +102,13 @@
           <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
             file="'%s/testcases/security/pwd_storage/security_teardown_pwd_storage.xml' % (TESTS_DIR)"/>
           <call function="'teardown_pwd_storage'" />
-  
-          <!--- Stop DS -->
-          <message>
-             'Stop DS running on port %s' % (DIRECTORY_INSTANCE_PORT)
-          </message>
 
-          <call function="'StopDsWithScript'">
-              { 'location'  : STAF_REMOTE_HOSTNAME,
-                'dsHost'    : DIRECTORY_INSTANCE_HOST,
-                'dsPort'    : DIRECTORY_INSTANCE_PORT,
-                'dsBindDN'  : DIRECTORY_INSTANCE_DN,
-                'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
-          </call>
 
-          <call function="'checkRC'">
-              { 'returncode' : RC ,
-                'result'     : STAXResult }
-          </call>
-  
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'security_cleanup'"/>
+									  
+
           <call function="'testSuite_Postamble'"/>
     
         </sequence>
diff --git a/opends/tests/functional-tests/testcases/security/pwd_validator/security_pwd_validator.xml b/opends/tests/functional-tests/testcases/security/pwd_validator/security_pwd_validator.xml
index 96c5d31..d8465b9 100755
--- a/opends/tests/functional-tests/testcases/security/pwd_validator/security_pwd_validator.xml
+++ b/opends/tests/functional-tests/testcases/security/pwd_validator/security_pwd_validator.xml
@@ -38,31 +38,19 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='security'								  							  			  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
     
         <call function="'testSuite_Preamble'"/>
-          
-        <!--- Start DS -->
-        <message>
-           'Start DS to run on port %s' % DIRECTORY_INSTANCE_PORT
-        </message>
 
-        <!--- Start DS -->
-        <call function="'StartDsWithScript'">
-         { 'location'  : STAF_REMOTE_HOSTNAME }
-        </call>
 
-        <call function="'checkRC'">
-            { 'returncode' : RC ,
-              'result'     : STAXResult }
-        </call>
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_setup.xml' % (TESTS_DIR)"/>
+          <call function="'security_setup'"/>
 
-        <!--- Check that DS started -->
-        <call function="'isAlive'">
-          { 'noOfLoops'        : 5 ,
-            'noOfMilliSeconds' : 2000 }
-        </call>
+												          
 
         <import machine="'%s' % STAF_LOCAL_HOSTNAME"
           file="'%s/testcases/security/pwd_validator/security_setup_pwd_validator.xml' % (TESTS_DIR)"/>
@@ -80,24 +68,13 @@
           file="'%s/testcases/security/pwd_validator/security_teardown_pwd_validator.xml' % (TESTS_DIR)"/>
         <call function="'teardown_pwd_validator'" />
 
-        <!--- Stop DS -->
-          <message>
-             'Stop DS running on port %s' % DIRECTORY_INSTANCE_PORT
-          </message>
 
-          <call function="'StopDsWithScript'">
-              { 'location'  : STAF_REMOTE_HOSTNAME,
-                'dsHost'    : DIRECTORY_INSTANCE_HOST,
-                'dsPort'    : DIRECTORY_INSTANCE_PORT,
-                'dsBindDN'  : DIRECTORY_INSTANCE_DN,
-                'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
-          </call>
 
-          <call function="'checkRC'">
-              { 'returncode' : RC ,
-                'result'     : STAXResult }
-          </call>
-    
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'security_cleanup'"/>
+
+												    
           <call function="'testSuite_Postamble'"/>
           
         </sequence>
diff --git a/opends/tests/functional-tests/testcases/security/sasl/security_sasl.xml b/opends/tests/functional-tests/testcases/security/sasl/security_sasl.xml
index c56d35d..73f4e47 100755
--- a/opends/tests/functional-tests/testcases/security/sasl/security_sasl.xml
+++ b/opends/tests/functional-tests/testcases/security/sasl/security_sasl.xml
@@ -38,31 +38,19 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='security'								  							  			  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
       
           <call function="'testSuite_Preamble'"/>
-            
-          <!--- Start DS -->
-          <message>
-             'Start DS to run on port %s' % DIRECTORY_INSTANCE_PORT
-          </message>
-  
-          <!--- Start DS -->
-          <call function="'StartDsWithScript'">
-           { 'location'  : STAF_REMOTE_HOSTNAME }
-          </call>
-  
-          <call function="'checkRC'">
-              { 'returncode' : RC ,
-                'result'     : STAXResult }
-          </call>
-  
-          <!--- Check that DS started -->
-          <call function="'isAlive'">
-            { 'noOfLoops'        : 5 ,
-              'noOfMilliSeconds' : 2000 }
-          </call>
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_setup.xml' % (TESTS_DIR)"/>
+          <call function="'security_setup'"/>
+
+												            
   
           <import machine="'%s' % STAF_LOCAL_HOSTNAME"
             file="'%s/testcases/security/sasl/security_setup_sasl.xml' % (TESTS_DIR)"/>
@@ -87,25 +75,14 @@
           <import machine="'%s' % STAF_LOCAL_HOSTNAME"
             file="'%s/testcases/security/sasl/security_teardown_sasl.xml' % (TESTS_DIR)"/>
           <call function="'teardown_sasl'" />
-  
-          <!--- Stop DS -->
-          <message>
-             'Stop DS running on port %s' % DIRECTORY_INSTANCE_PORT
-          </message>
 
-          <call function="'StopDsWithScript'">
-              { 'location'  : STAF_REMOTE_HOSTNAME,
-                'dsHost'    : DIRECTORY_INSTANCE_HOST,
-                'dsPort'    : DIRECTORY_INSTANCE_PORT,
-                'dsBindDN'  : DIRECTORY_INSTANCE_DN,
-                'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
-          </call>
 
-          <call function="'checkRC'">
-              { 'returncode' : RC ,
-                'result'     : STAXResult }
-          </call>
-    
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'security_cleanup'"/>
+
+												    
           <call function="'testSuite_Postamble'"/>
             
         </sequence>
diff --git a/opends/tests/functional-tests/testcases/security/security.xml b/opends/tests/functional-tests/testcases/security/security.xml
index a483e6c..6e67f9a 100755
--- a/opends/tests/functional-tests/testcases/security/security.xml
+++ b/opends/tests/functional-tests/testcases/security/security.xml
@@ -42,7 +42,9 @@
           </script>
         
           <call function="'testGroup_Preamble'"/>
-     
+			
+
+			
           <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
             file="'%s/testcases/security/jks/security_jks.xml' % (TESTS_DIR)"/>
           <call function="'security_jks'" />
@@ -86,7 +88,9 @@
           <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
             file="'%s/testcases/security/account_activation/security_account_activation.xml' % (TESTS_DIR)"/>
           <call function="'security_account_activation'" />
-  
+
+			
+
           <call function="'testGroup_Postamble'"/>
         
         </sequence>
diff --git a/opends/tests/functional-tests/testcases/security/security_cleanup.xml b/opends/tests/functional-tests/testcases/security/security_cleanup.xml
new file mode 100755
index 0000000..b575f3c
--- /dev/null
+++ b/opends/tests/functional-tests/testcases/security/security_cleanup.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE stax SYSTEM "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 2007 Sun Microsystems, Inc.
+ ! -->
+<stax>
+
+  <defaultcall function="security_cleanup"/>
+
+  <function name="security_cleanup">
+
+    <sequence>
+
+      <block name="'cleanup'">
+      
+        <sequence>
+
+			
+          <block name="'Block DS Process Stop'">				
+          <!--- Stop DS -->
+		    <sequence>
+              <message>
+                 'Stop DS running on port %s' % (DIRECTORY_INSTANCE_PORT)
+              </message>
+
+              <call function="'StopDsWithScript'">
+                { 'location'  : STAF_REMOTE_HOSTNAME,
+                  'dsHost'    : DIRECTORY_INSTANCE_HOST,
+                  'dsPort'    : DIRECTORY_INSTANCE_PORT,
+                  'dsBindDN'  : DIRECTORY_INSTANCE_DN,
+                  'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
+              </call>
+
+              <call function="'checkRC'">
+                  { 'returncode' : RC ,
+                    'result'     : STAXResult }
+              </call>
+
+		    </sequence>			  
+          <!--- End Block DS Process Stop -->
+          </block>
+			
+						  			  			  
+
+		  <block name="'Block Remove DS Topology'">
+		  <!-- Remove  the topology created for the test suite -->
+			<sequence>
+				
+              <message>
+                 'Remove DS topology created for the Test Suite'
+              </message>				  
+
+			  <call function="'removeTopology'"/>
+				
+			  <call function="'checkRC'">
+                  { 'returncode' : RC ,
+                    'result'     : STAXResult }
+              </call>
+			
+			</sequence>			  
+		  <!-- End Block Remove DS Topology-->  
+		  </block>	  														  
+			        
+			
+        </sequence>        
+      </block>
+            
+     </sequence>
+
+  </function>
+
+</stax>
diff --git a/opends/tests/functional-tests/testcases/security/security_setup.xml b/opends/tests/functional-tests/testcases/security/security_setup.xml
new file mode 100755
index 0000000..de9ae46
--- /dev/null
+++ b/opends/tests/functional-tests/testcases/security/security_setup.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE stax SYSTEM "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 2007 Sun Microsystems, Inc.
+ ! -->
+<stax>
+
+  <defaultcall function="security_setup"/>
+
+  <function name="security_setup">
+
+    <sequence>
+
+      <block name="'setup'">
+      
+        <sequence>
+
+
+		  <block name="'Block Create DS Topology'">
+		  <!-- Create the topology necessary to the test group/suite -->
+		    <sequence>
+								
+              <message>
+                 'Create DS topology as described in config.py'
+              </message>
+				  
+			  <call function="'createTopology'">
+			    { 'initialiseInstance' : True }
+			  </call>
+				    				
+			  <call function="'checkRC'">
+                  { 'returncode' : RC ,
+                    'result'     : STAXResult }
+              </call>
+      
+            </sequence>      
+          <!--- End Block Create DS Topology -->	
+          </block>				  				  
+
+
+		  <block name="'Block DS Process Active'">	  	
+          <!--- Start DS -->
+		    <sequence>
+				
+              <message>
+                 'Start DS to run on port %s' % (DIRECTORY_INSTANCE_PORT)
+              </message>
+  
+              <!--- Start DS -->
+              <call function="'StartDsWithScript'">
+               { 'location'  : STAF_REMOTE_HOSTNAME }
+              </call>
+  
+              <call function="'checkRC'">
+                  { 'returncode' : RC ,
+                    'result'     : STAXResult }
+              </call>
+  
+              <!--- Check that DS started -->
+              <call function="'isAlive'">
+                { 'noOfLoops'        : 5 ,
+                  'noOfMilliSeconds' : 2000 }
+              </call>			
+				
+            </sequence>
+          <!--- End Block DS Process Active -->
+          </block>			  			
+						
+			        
+        </sequence>        
+      </block>
+            
+     </sequence>
+
+  </function>
+
+</stax>
diff --git a/opends/tests/functional-tests/testcases/security/startTLS/security_startTLS.xml b/opends/tests/functional-tests/testcases/security/startTLS/security_startTLS.xml
index 3750a49..bd2f9e8 100755
--- a/opends/tests/functional-tests/testcases/security/startTLS/security_startTLS.xml
+++ b/opends/tests/functional-tests/testcases/security/startTLS/security_startTLS.xml
@@ -31,77 +31,59 @@
 
   <function name="security_startTLS">
 
-  	<sequence>
+    <sequence>
 
   	  <block name="'start-tls'">
-
+  	  
   	    <sequence>
-
-  	      <script>
+  	      	  
+          <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='security'								  							  			  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
+      
+          <call function="'testSuite_Preamble'"/>
 
-  	      <call function="'testSuite_Preamble'" />
 
-  	      <!--- Start DS -->
-  	      <message>
-  	        'Start DS to run on port %s' % DIRECTORY_INSTANCE_PORT
-  	      </message>
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_setup.xml' % (TESTS_DIR)"/>
+          <call function="'security_setup'"/>
 
-  	      <!--- Start DS -->
-  	      <call function="'StartDsWithScript'">
-  	        { 'location' : STAF_REMOTE_HOSTNAME }
-  	      </call>
+								        
 
-  	      <call function="'checkRC'">
-  	        { 'returncode' : RC , 'result' : STAXResult }
-  	      </call>
 
-  	      <!--- Check that DS started -->
-  	      <call function="'isAlive'">
-  	        { 'noOfLoops' : 5 , 'noOfMilliSeconds' : 2000 }
-  	      </call>
+          <import machine="'%s' % STAF_LOCAL_HOSTNAME"
+            file="'%s/testcases/security/startTLS/security_setup_startTLS.xml' % (TESTS_DIR)"/>
+          <call function="'setup_startTLS'" />
 
-  	      <import machine="'%s' % STAF_LOCAL_HOSTNAME"
-  	        file="'%s/testcases/security/startTLS/security_setup_startTLS.xml' % (TESTS_DIR)" />
-  	      <call function="'setup_startTLS'" />
+          <import machine="'%s' % STAF_LOCAL_HOSTNAME"
+            file="'%s/testcases/security/startTLS/security_bob_startTLS.xml' % (TESTS_DIR)"/>
+          <call function="'bob_startTLS'" />
+    
+          <import machine="'%s' % STAF_LOCAL_HOSTNAME"
+            file="'%s/testcases/security/startTLS/security_force_pwd_change_startTLS.xml' % (TESTS_DIR)"/>
+          <call function="'force_pwd_change_startTLS'" />
 
-  	      <import machine="'%s' % STAF_LOCAL_HOSTNAME"
-  	        file="'%s/testcases/security/startTLS/security_bob_startTLS.xml' % (TESTS_DIR)" />
-  	      <call function="'bob_startTLS'" />
+          <import machine="'%s' % STAF_LOCAL_HOSTNAME"
+            file="'%s/testcases/security/startTLS/security_teardown_startTLS.xml' % (TESTS_DIR)"/>
+          <call function="'teardown_startTLS'" />
+ 
 
-  	      <import machine="'%s' % STAF_LOCAL_HOSTNAME"
-  	        file="'%s/testcases/security/startTLS/security_force_pwd_change_startTLS.xml' % (TESTS_DIR)" />
-  	      <call function="'force_pwd_change_startTLS'" />
 
-  	      <import machine="'%s' % STAF_LOCAL_HOSTNAME"
-  	        file="'%s/testcases/security/startTLS/security_teardown_startTLS.xml' % (TESTS_DIR)" />
-  	      <call function="'teardown_startTLS'" />
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/security/security_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'security_cleanup'"/>
 
-  	      <!--- Stop DS -->
-  	      <message>
-  	        'Stop DS running on port %s' % DIRECTORY_INSTANCE_PORT
-  	      </message>
+								
 
-  	      <call function="'StopDsWithScript'">
-  	        { 'location'  : STAF_REMOTE_HOSTNAME, 
-              'dsHost'    : DIRECTORY_INSTANCE_HOST,
-              'dsPort'    : DIRECTORY_INSTANCE_PORT, 
-              'dsBindDN'  : DIRECTORY_INSTANCE_DN, 
-              'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
-  	      </call>
-
-  	      <call function="'checkRC'">
-  	        { 'returncode' : RC , 'result' : STAXResult }
-  	      </call>
-
-  	      <call function="'testSuite_Postamble'" />
+          <call function="'testSuite_Postamble'"/>
 
   	    </sequence>
 
   	  </block>
-
-  	</sequence>
+        
+    </sequence>
 
   </function>
 
diff --git a/opends/tests/functional-tests/testcases/synchronization/basic/synchronization_basic.xml b/opends/tests/functional-tests/testcases/synchronization/basic/synchronization_basic.xml
index 4b7a5c2..40c89d9 100644
--- a/opends/tests/functional-tests/testcases/synchronization/basic/synchronization_basic.xml
+++ b/opends/tests/functional-tests/testcases/synchronization/basic/synchronization_basic.xml
@@ -38,7 +38,9 @@
         <sequence>
   
           <script>
-            CurrentTestPath['suite']='basic'
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='synchronization'								  							  			  
+            CurrentTestPath['suite']=STAXCurrentBlock
           </script>
             
           <call function="'testSuite_Preamble'"/>
@@ -52,7 +54,7 @@
           #@TestScript          synchronization_basic.xml
           #@TestHTMLLink        http://opends.dev.java.net/
           -->
-     		              
+						     		              
 
 		  <block name="'Block Create DS Topology'">
 		  <!-- Create the topology necessary to the test suite -->
@@ -173,10 +175,12 @@
 			<sequence>
 				
               <message>
-                 '(NOT IMPLEMENTED YET) Remove DS topology created for the Synchronization Basic Test Suite'
+                 'Remove DS topology created for the Synchronization Basic Test Suite'
               </message>				  
 
-			  <call function="'removeTopology'"/>  
+			  <call function="'removeTopology'">
+			    { 'multipleInstanceTopology' : True }
+			  </call>  
 				
 			  <call function="'checkRC'">
                   { 'returncode' : RC ,
diff --git a/opends/tests/functional-tests/testcases/synchronization/basic/synchronization_basic_bob.xml b/opends/tests/functional-tests/testcases/synchronization/basic/synchronization_basic_bob.xml
index 27047e6..4875fb6 100644
--- a/opends/tests/functional-tests/testcases/synchronization/basic/synchronization_basic_bob.xml
+++ b/opends/tests/functional-tests/testcases/synchronization/basic/synchronization_basic_bob.xml
@@ -60,7 +60,7 @@
                   'entryToBeAdded'   : '%s/synchronization_add_root_suffix.ldif' % clientDataDir }
               </call>
     
-              <call function="'checktestRC'">
+              <call function="'checkRC'">
                   { 'returncode' : RC,
                     'result'     : STAXResult }
               </call>
@@ -115,7 +115,7 @@
                   'entryToBeAdded'   : '%s/synchronization_add_single.ldif' % clientDataDir }
               </call>
     
-              <call function="'checktestRC'">
+              <call function="'checkRC'">
                   { 'returncode' : RC ,
                     'result'     : STAXResult }
               </call>				
@@ -131,7 +131,7 @@
                   'entryToBeModified'   : '%s/synchronization_mod.ldif' % clientDataDir }
               </call>
     
-              <call function="'checktestRC'">
+              <call function="'checkRC'">
                   { 'returncode' : RC ,
                     'result'     : STAXResult }
               </call>
@@ -185,7 +185,7 @@
                   'dsBaseDN'   : entryDn }
               </call>
     
-              <call function="'checktestRC'">
+              <call function="'checkRC'">
                   { 'returncode' : RC ,
                     'result'     : STAXResult }
               </call>
@@ -211,8 +211,6 @@
             </sequence>
           </testcase>
 			
-          
-          <call function="'testSuite_Postamble'"/>
 
     
     </sequence>

--
Gitblit v1.10.0