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

---
 opendj-sdk/opends/tests/functional-tests/testcases/backends/backends.xml          |   13 
 opendj-sdk/opends/tests/functional-tests/testcases/backends/export-tasks.xml      |   48 +-
 opendj-sdk/opends/tests/functional-tests/testcases/backends/backend_setup.xml     |  140 +++++++++
 opendj-sdk/opends/tests/functional-tests/testcases/core/core_version_report.xml   |   24 +
 opendj-sdk/opends/tests/functional-tests/testcases/backends/export.xml            |   32 +
 opendj-sdk/opends/tests/functional-tests/testcases/core/core_entry_cache.xml      |   24 +
 opendj-sdk/opends/tests/functional-tests/testcases/core/core_search_timelimit.xml |   24 +
 opendj-sdk/opends/tests/functional-tests/testcases/core/core_cleanup.xml          |   94 ++++++
 opendj-sdk/opends/tests/functional-tests/testcases/backends/backend_cleanup.xml   |  103 ++++++
 opendj-sdk/opends/tests/functional-tests/testcases/backends/restore-tasks.xml     |   16 +
 opendj-sdk/opends/tests/functional-tests/testcases/core/core_setup.xml            |  109 ++++--
 opendj-sdk/opends/tests/functional-tests/testcases/backends/backup-tasks.xml      |   40 +-
 opendj-sdk/opends/tests/functional-tests/testcases/backends/import-tasks.xml      |   55 +--
 opendj-sdk/opends/tests/functional-tests/testcases/backends/restore.xml           |   21 +
 opendj-sdk/opends/tests/functional-tests/testcases/core/core_search_sizelimit.xml |   25 +
 opendj-sdk/opends/tests/functional-tests/testcases/core/core_tf_filters.xml       |   24 +
 opendj-sdk/opends/tests/functional-tests/testcases/backends/backup.xml            |   21 +
 opendj-sdk/opends/tests/functional-tests/testcases/backends/import.xml            |   19 +
 opendj-sdk/opends/tests/functional-tests/testcases/core/core.xml                  |   48 --
 19 files changed, 645 insertions(+), 235 deletions(-)

diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/backends/backend_cleanup.xml b/opendj-sdk/opends/tests/functional-tests/testcases/backends/backend_cleanup.xml
new file mode 100755
index 0000000..4ca3a5a
--- /dev/null
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/backends/backend_cleanup.xml
@@ -0,0 +1,103 @@
+<?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="backend_cleanup"/>
+
+  <function name="backend_cleanup">
+    <function-map-args>
+      <function-arg-def name="stopDS" type="optional" default="True">
+        <function-arg-description>
+          Optional stop the Directory Server
+        </function-arg-description>
+        <function-arg-property name="type" value="boolean"/>
+      </function-arg-def>    
+	</function-map-args>	  
+
+    <sequence>
+
+      <block name="'cleanup'">
+      
+        <sequence>
+
+          <if expr="stopDS == True">			
+          <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>
+		  </if>
+			
+						  			  			  
+
+		  <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/opendj-sdk/opends/tests/functional-tests/testcases/backends/backend_setup.xml b/opendj-sdk/opends/tests/functional-tests/testcases/backends/backend_setup.xml
new file mode 100755
index 0000000..4cd8eba
--- /dev/null
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/backends/backend_setup.xml
@@ -0,0 +1,140 @@
+<?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="backend_setup"/>
+
+  <function name="backend_setup">
+    <function-map-args>
+      <function-arg-def name="startDS" type="optional" default="True">
+        <function-arg-description>
+          Optional start the Directory Server
+        </function-arg-description>
+        <function-arg-property name="type" value="boolean"/>
+      </function-arg-def>  
+	  <function-arg-def name="loadBackend" type="optional" default="False">
+	    <function-arg-description>
+		  Specifies whether the backend should be loaded with some data.
+		</function-arg-description>
+		<function-arg-property name="type" value="boolean"/>
+	  </function-arg-def>					  
+	</function-map-args>
+
+    <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' : False }
+			  </call>
+				    				
+			  <call function="'checkRC'">
+                  { 'returncode' : RC ,
+                    'result'     : STAXResult }
+              </call>
+      
+            </sequence>      
+          <!--- End Block Create DS Topology -->	
+          </block>				  				  
+
+
+
+          <if expr="loadBackend == True">
+		  <block name="'Block DS Load Data'">
+		  <!-- Load the data needed by the test suite -->
+		    <sequence>		
+					  
+              <message>
+                'Backend: Backend Setup for Export, Backup, and Restore Tests'
+              </message>
+              <call function="'importLdif'">
+                { 'ldifFile'    : '%s/backends/backend_start.ldif' % STAGED_DATA_DIR }
+              </call>
+    
+              <call function="'checkRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult }
+              </call>	
+
+            </sequence>      
+          <!--- End Block DS Load Data -->								  	   
+		  </block> 
+		  </if>
+			
+									
+		  <if expr="startDS == True">
+		  <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>			  			
+		  </if>
+						
+				  				  
+			        
+        </sequence>        
+      </block>
+            
+     </sequence>
+
+  </function>
+
+</stax>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/backends/backends.xml b/opendj-sdk/opends/tests/functional-tests/testcases/backends/backends.xml
index 00c339a..ee78abe 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/backends/backends.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/backends/backends.xml
@@ -42,7 +42,8 @@
           </script>
       
           <call function="'testGroup_Preamble'"/>
-                
+			
+			                
           <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
             file="'%s/testcases/backends/import.xml' % (TESTS_DIR)"/>
           <call function="'main_import'" />
@@ -52,10 +53,6 @@
           <call function="'main_import-tasks'" />
                
           <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
-            file="'%s/testcases/backends/backendsetup.xml' % (TESTS_DIR)"/>
-          <call function="'main_backend-setup'" />
-  
-          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
             file="'%s/testcases/backends/backup-tasks.xml' % (TESTS_DIR)"/>
           <call function="'main_backup-tasks'" />
           
@@ -78,10 +75,8 @@
           <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
             file="'%s/testcases/backends/export.xml' % (TESTS_DIR)"/>
           <call function="'main_export'" />
-          
-          <!-- Set the server backup the way it was before the backend tests -->
-          <call function="'main_quickstart'" />
-          
+					
+			          
           <call function="'testGroup_Postamble'"/>
         
         </sequence>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/backends/backup-tasks.xml b/opendj-sdk/opends/tests/functional-tests/testcases/backends/backup-tasks.xml
index 4600aad..18941c1 100755
--- a/opendj-sdk/opends/tests/functional-tests/testcases/backends/backup-tasks.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/backends/backup-tasks.xml
@@ -39,33 +39,19 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='backends'						  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
           
           <call function="'testSuite_Preamble'"/>
-    
-            <!--- Start DS -->
-            <sequence>
-              <message>
-                 'Start DS to run on port %s' % (DIRECTORY_INSTANCE_PORT)
-              </message>
-      
-              <call function="'StartDsWithScript'">
-               { 'location'  : STAF_REMOTE_HOSTNAME }
-              </call>
-     
-              <call function="'checkRC'">
-                  { 'returncode' : RC ,
-                    'result'     : STAXResult }
-              </call>
-     
-            </sequence>
-                    
-                <!--- Check that DS started -->
-                <call function="'isAlive'">
-                  { 'noOfLoops'        : 5 ,
-                    'noOfMilliSeconds' : 2000 }
-                </call>
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/backends/backend_setup.xml' % (TESTS_DIR)"/>
+          <call function="'backend_setup'"> { 'loadBackend' : True } </call>
+
+															
                   
                   <testcase name="'Backend: Backup Tasks 1'">
                   
@@ -96,7 +82,13 @@
           
                 </testcase>
             
-    
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/backends/backend_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'backend_cleanup'"/>
+
+												    
           <call function="'testSuite_Postamble'"/>
       
         </sequence>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/backends/backup.xml b/opendj-sdk/opends/tests/functional-tests/testcases/backends/backup.xml
index e5c5fa5..2bf81cc 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/backends/backup.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/backends/backup.xml
@@ -39,6 +39,8 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='backends'						  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
       
@@ -53,7 +55,16 @@
             #@TestScript          backup.xml
             #@TestHTMLLink        http://opends.dev.java.net/
           -->
-    
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/backends/backend_setup.xml' % (TESTS_DIR)"/>
+          <call function="'backend_setup'"> 
+            { 'startDS' : False,
+			  'loadBackend' : True } 
+		  </call>	  
+
+												    
           <!--- Test Case information
             #@TestMarker          Backend Backup Tests
             #@TestName            Export: Backup 1
@@ -242,7 +253,13 @@
             </sequence>
     
           </testcase>
-            
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/backends/backend_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'backend_cleanup'"> { 'stopDS' : False } </call>
+
+												            
           <call function="'testSuite_Postamble'"/>
             
         </sequence>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/backends/export-tasks.xml b/opendj-sdk/opends/tests/functional-tests/testcases/backends/export-tasks.xml
index c068b15..dec762f 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/backends/export-tasks.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/backends/export-tasks.xml
@@ -39,36 +39,13 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='backends'						  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
           
           <call function="'testSuite_Preamble'"/>
-    
-             <!--- Start DS -->
-             <sequence>
-               <message>
-                  'Start DS to run on port %s' % (DIRECTORY_INSTANCE_PORT)
-               </message>
-      
-                <call function="'StartDsWithScript'">
-                 { 'location'  : STAF_REMOTE_HOSTNAME }
-                </call>
-     
-               <call function="'checkRC'">
-                   { 'returncode' : RC ,
-                     'result'     : STAXResult }
-               </call>
-     
-             </sequence>
-           
-             <sequence>
-             
-                <!--- Check that DS started -->
-                <call function="'isAlive'">
-                  { 'noOfLoops'        : 5 ,
-                    'noOfMilliSeconds' : 2000 }
-                </call>
-            
+
           <!--- Test Suite information
             #@TestSuiteName       Backend Export Tasks Tests
             #@TestSuitePurpose    Verify that the basic export task functionality is working in the Directory Server.
@@ -77,7 +54,16 @@
             #@TestGroup           Backend
             #@TestScript          export.xml
             #@TestHTMLLink        http://opends.dev.java.net/
-          -->
+          -->			
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/backends/backend_setup.xml' % (TESTS_DIR)"/>
+          <call function="'backend_setup'"> { 'loadBackend' : True } </call>
+
+												    
+             <sequence>
+            
+
     
           <!--- Test Case information
             #@TestMarker          Backend Export Tasks Tests
@@ -398,7 +384,13 @@
             #@TestResult
           -->
              </sequence>
-             
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/backends/backend_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'backend_cleanup'"/>
+
+												             
           <call function="'testSuite_Postamble'"/>
       
         </sequence>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/backends/export.xml b/opendj-sdk/opends/tests/functional-tests/testcases/backends/export.xml
index b382ab6..1719a20 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/backends/export.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/backends/export.xml
@@ -39,6 +39,8 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='backends'						  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
       
@@ -52,8 +54,17 @@
             #@TestGroup           Backend
             #@TestScript          export.xml
             #@TestHTMLLink        http://opends.dev.java.net/
-         -->    
-                
+          -->
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/backends/backend_setup.xml' % (TESTS_DIR)"/>
+          <call function="'backend_setup'"> 
+            { 'startDS' : False,
+			  'loadBackend' : True } 
+		  </call>	  
+												    
+			                
                 
          <!-- Create a second instance to import data that was exported from the first instance -->
          <message>
@@ -78,8 +89,9 @@
           
           <!-- Set the server backup the way it was before the backend tests -->
           <call function="'main_quickstart'" />
-          
-          
+
+			          
+         
           <!--- Test Case information
             #@TestMarker          Backend Export Tests
             #@TestName            Backend: Export: LDIF Default 
@@ -2028,8 +2040,16 @@
             #@TestPostamble
             #@TestResult          Success if exportLDIF, importLDIF, and checkImport returns 0
           -->
-                 <!-- Need to know what the error codes are -->
-    
+
+
+                 <!-- Need to know what the error codes are -->									
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/backends/backend_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'backend_cleanup'"> { 'stopDS' : False } </call>
+
+												    
         </sequence>
     
       </block>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/backends/import-tasks.xml b/opendj-sdk/opends/tests/functional-tests/testcases/backends/import-tasks.xml
index 1000f48..9d1af78 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/backends/import-tasks.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/backends/import-tasks.xml
@@ -39,30 +39,12 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='backends'						  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
           
           <call function="'testSuite_Preamble'"/>
-        
-          <!--- Start DS -->
-          <message>
-            'Start DS to run on port %s' % DIRECTORY_INSTANCE_PORT
-          </message>
-
-          <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>
 
           <!--- Test Suite information
             #@TestSuiteName       Backend Import Tasks Tests
@@ -73,7 +55,13 @@
             #@TestScript          import-tasks.xml
             #@TestHTMLLink        http://opends.dev.java.net/
           -->
-    
+		
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/backends/backend_setup.xml' % (TESTS_DIR)"/>
+          <call function="'backend_setup'" />			
+			
+						   
           <!--- Test Case information
             #@TestMarker          Backend Import Tasks Tests
             #@TestName            Import Tasks: LDIF Default
@@ -1357,25 +1345,12 @@
 
             <!-- Need to know what the error codes are -->
                 
-          <!--- Stop DS --> 
-          <message>
-            'Stop DS running on port %s' % (DIRECTORY_INSTANCE_PORT)
-          </message>
-          
-          <!--- Stop DS -->
-          <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/backends/backend_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'backend_cleanup'" />
+									
+						          
           <call function="'testSuite_Postamble'"/>
 
         </sequence>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/backends/import.xml b/opendj-sdk/opends/tests/functional-tests/testcases/backends/import.xml
index 1f0f943..a17f609 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/backends/import.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/backends/import.xml
@@ -39,6 +39,8 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='backends'						  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
                       
@@ -53,7 +55,13 @@
           #@TestScript          import.xml
           #@TestHTMLLink        http://opends.dev.java.net/
           -->
-     
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/backends/backend_setup.xml' % (TESTS_DIR)"/>
+          <call function="'backend_setup'"> { 'startDS' : False } </call>
+				
+						     
           <!--- Test Case information
           #@TestMarker          Backend Import Tests
           #@TestName            Backend: Import: LDIF Default
@@ -1190,7 +1198,14 @@
           -->
     
           <!-- Need to know what the error codes are -->
-    
+
+			
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/backends/backend_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'backend_cleanup'"> { 'stopDS' : False } </call>			  	
+			
+						    
           <call function="'testSuite_Postamble'"/>
   
         </sequence>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/backends/restore-tasks.xml b/opendj-sdk/opends/tests/functional-tests/testcases/backends/restore-tasks.xml
index b2f554c..4f75a77 100755
--- a/opendj-sdk/opends/tests/functional-tests/testcases/backends/restore-tasks.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/backends/restore-tasks.xml
@@ -39,6 +39,8 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='backends'						  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
           
@@ -53,7 +55,13 @@
             #@TestScript          restore-tasks.xml
             #@TestHTMLLink        http://opends.dev.java.net/
           -->
-    
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/backends/backend_setup.xml' % (TESTS_DIR)"/>
+          <call function="'backend_setup'"> { 'loadBackend' : True } </call>	  
+
+												    
           <!--- Test Case information
             #@TestMarker          Backend Restore Tasks Tests
             #@TestName            Restore Tasks: Restore Tasks 1
@@ -97,6 +105,12 @@
       
             </testcase>
 
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/backends/backend_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'backend_cleanup'"/>
+
+												
           <call function="'testSuite_Postamble'"/>
       
         </sequence>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/backends/restore.xml b/opendj-sdk/opends/tests/functional-tests/testcases/backends/restore.xml
index 14d8328..73d870e 100755
--- a/opendj-sdk/opends/tests/functional-tests/testcases/backends/restore.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/backends/restore.xml
@@ -39,6 +39,8 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='backends'						  
             CurrentTestPath['suite']=STAXCurrentBlock
           </script>
           
@@ -53,7 +55,16 @@
             #@TestScript          restore.xml
             #@TestHTMLLink        http://opends.dev.java.net/
           -->
-    
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/backends/backend_setup.xml' % (TESTS_DIR)"/>
+          <call function="'backend_setup'"> 
+            { 'startDS' : False,
+			  'loadBackend' : True } 
+		  </call>	  
+
+															    
           <!--- Test Case information
             #@TestMarker          Backend Restore Tests
             #@TestName            Export: Restore 1
@@ -198,7 +209,13 @@
               </sequence>
       
             </testcase>
-            
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/backends/backend_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'backend_cleanup'"> { 'stopDS' : True } </call>
+
+												            
           <call function="'testSuite_Postamble'"/>
       
         </sequence>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/core/core.xml b/opendj-sdk/opends/tests/functional-tests/testcases/core/core.xml
index b2c4732..ade053c 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/core/core.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/core/core.xml
@@ -42,31 +42,9 @@
           </script>
             
           <call function="'testGroup_Preamble'"/>
-          
-          <!-- Start DS -->
-          <message>
-             'Start DS to run on port %s' % (DIRECTORY_INSTANCE_PORT)
-          </message>
-   
-          <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/core/core_setup.xml' % (TESTS_DIR)"/>
-          <call function="'core_setup'" />
-          
+			
+			
+			          
           <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
             file="'%s/testcases/core/core_entry_cache.xml' % (TESTS_DIR)"/>
           <call function="'core_entry_cache'" />
@@ -87,24 +65,8 @@
             file="'%s/testcases/core/core_version_report.xml' % (TESTS_DIR)"/>
           <call function="'core_version_report'" />
           
-          <!-- 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/opendj-sdk/opends/tests/functional-tests/testcases/core/core_cleanup.xml b/opendj-sdk/opends/tests/functional-tests/testcases/core/core_cleanup.xml
new file mode 100755
index 0000000..b1f025e
--- /dev/null
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/core/core_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="core_cleanup"/>
+
+  <function name="core_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/opendj-sdk/opends/tests/functional-tests/testcases/core/core_entry_cache.xml b/opendj-sdk/opends/tests/functional-tests/testcases/core/core_entry_cache.xml
index fb2767d..6ee1196 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/core/core_entry_cache.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/core/core_entry_cache.xml
@@ -38,17 +38,19 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='core'						  
             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/core/core_setup.xml' % (TESTS_DIR)"/>
+          <call function="'core_setup'"/>
+
+												    
           <!--- Test Case : Entry Cache: Default Search -->
           <testcase name="'Core: Entry Cache: Default Search'">
             <sequence>
@@ -223,7 +225,13 @@
             </sequence>
             
           </testcase>
-          
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/core/core_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'core_cleanup'"/>
+
+												          
           <call function="'testSuite_Postamble'"/>
 
         </sequence>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/core/core_search_sizelimit.xml b/opendj-sdk/opends/tests/functional-tests/testcases/core/core_search_sizelimit.xml
index 4bd162c..997c063 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/core/core_search_sizelimit.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/core/core_search_sizelimit.xml
@@ -38,17 +38,20 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='core'								  
             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/core/core_setup.xml' % (TESTS_DIR)"/>
+          <call function="'core_setup'"/>
+
+												    
+
           <!--- Test Case : Search Size Limit: Size Limit Exceeded -->
           <testcase name="'Core: Search Size Limit: Size Limit Exceeded'">
             <sequence>
@@ -327,7 +330,13 @@
               
             </sequence>
           </testcase>
-          
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/core/core_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'core_cleanup'"/>
+
+												          
           <call function="'testSuite_Postamble'"/>
 
         </sequence>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/core/core_search_timelimit.xml b/opendj-sdk/opends/tests/functional-tests/testcases/core/core_search_timelimit.xml
index 5fc4448..076f993 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/core/core_search_timelimit.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/core/core_search_timelimit.xml
@@ -38,17 +38,19 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='core'								  
             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/core/core_setup.xml' % (TESTS_DIR)"/>
+          <call function="'core_setup'"/>
+
+												    
           <!--- Test Case : Search Time Limit: Time Limit Exceeded -->
           <testcase name="'Core: Search Time Limit: Time Limit Exceeded'">
             <sequence>
@@ -325,7 +327,13 @@
               <call function="'testCase_Postamble'"/>
             </sequence>
           </testcase>
-          
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/core/core_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'core_cleanup'"/>
+
+												          
           <call function="'testSuite_Postamble'"/>
 
         </sequence>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/core/core_setup.xml b/opendj-sdk/opends/tests/functional-tests/testcases/core/core_setup.xml
index 9ea149d..63d7f8c 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/core/core_setup.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/core/core_setup.xml
@@ -23,7 +23,7 @@
  !
  ! CDDL HEADER END
  !
- !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
 <stax>
 
@@ -31,28 +31,68 @@
 
   <function name="core_setup">
 
-     <sequence>
+    <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>
   
-          <script>
-            CurrentTestPath['suite']=STAXCurrentBlock
-          </script>
-            
-          <call function="'testSuite_Preamble'"/>
-    
-          <!--- Check that DS started -->
-          <call function="'isAlive'">
-            { 'noOfLoops'        : 5 ,
-              'noOfMilliSeconds' : 2000 }
-          </call>
-    
-          <!--- Test Case : Setup: Add required entries -->
-          <testcase name="'Core: Setup: Add Core 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 Core Tests'
               </message>
@@ -65,18 +105,13 @@
                   'entryToBeAdded'   : '%s/core/ldifs/core_start.ldif' % STAGED_DATA_DIR }
               </call>
     
-              <call function="'checktestRC'">
+              <call function="'checkRC'">
                   { 'returncode' : RC ,
                     'result'     : STAXResult }
               </call>
-              <call function="'testCase_Postamble'"/>
-            </sequence>
-          </testcase>
-          
-          <!--- Test Case : To add 1000 extra entries that are required for some of the Core Tests -->
-          <testcase name="'Core: Setup: Add 1000 Core Entries'">
-            <sequence>
-              <call function="'testCase_Preamble'"/>
+			
+
+						
               <message>
                  'Add 1000 extra entries that are required for some of the Core Tests'
               </message>
@@ -89,21 +124,19 @@
                   'entryToBeAdded'   : '%s/core/ldifs/core_test_1K.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/opendj-sdk/opends/tests/functional-tests/testcases/core/core_tf_filters.xml b/opendj-sdk/opends/tests/functional-tests/testcases/core/core_tf_filters.xml
index 67baead..2d5a092 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/core/core_tf_filters.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/core/core_tf_filters.xml
@@ -38,17 +38,19 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='core'								  
             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/core/core_setup.xml' % (TESTS_DIR)"/>
+          <call function="'core_setup'"/>
+
+												    
           <!--- Test Case : True False Filters: And Filter -->
           <testcase name="'Core: True False Filters: And Filter'">
             <sequence>
@@ -151,7 +153,13 @@
              </sequence>
     
           </testcase>
-          
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/core/core_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'core_cleanup'"/>
+
+												          
           <call function="'testSuite_Postamble'"/>
 
         </sequence>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/core/core_version_report.xml b/opendj-sdk/opends/tests/functional-tests/testcases/core/core_version_report.xml
index ca67bda..7122786 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/core/core_version_report.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/core/core_version_report.xml
@@ -38,17 +38,19 @@
         <sequence>
   
           <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='core'								  
             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/core/core_setup.xml' % (TESTS_DIR)"/>
+          <call function="'core_setup'"/>
+															
+
           <!--- Test Case : Version Report 1 -->
           <testcase name="'Core: Version Report: Search Version'">
             <sequence>
@@ -73,7 +75,13 @@
               <call function="'testCase_Postamble'"/>
             </sequence>
           </testcase>
-               
+
+
+          <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+            file="'%s/testcases/core/core_cleanup.xml' % (TESTS_DIR)"/>
+          <call function="'core_cleanup'"/>
+
+												               
           <call function="'testSuite_Postamble'"/>
 
         </sequence>

--
Gitblit v1.10.0