From 71df1f2b713463ca1a7c032f5e1d572a25920fc8 Mon Sep 17 00:00:00 2001
From: andrug <andrug@localhost>
Date: Fri, 04 Apr 2008 14:52:15 +0000
Subject: [PATCH] add client tag management for the reports

---
 opendj-sdk/opends/tests/system-tests/phases/scheduler/scheduler.xml          |   20 +++---
 opendj-sdk/opends/tests/system-tests/report/result.xsl                       |   17 +++++
 opendj-sdk/opends/tests/system-tests/scenario/sample2/pre_configuration.xml  |   33 ++++++++++
 opendj-sdk/opends/tests/system-tests/phases/main_run.xml                     |    6 +
 opendj-sdk/opends/tests/system-tests/scenario/sample2/post_configuration.xml |   33 +++++++++++
 opendj-sdk/opends/tests/system-tests/phases/log/log.xml                      |   56 +++++++++++++++++-
 6 files changed, 150 insertions(+), 15 deletions(-)

diff --git a/opendj-sdk/opends/tests/system-tests/phases/log/log.xml b/opendj-sdk/opends/tests/system-tests/phases/log/log.xml
index 14c6848..e4cd18e 100755
--- a/opendj-sdk/opends/tests/system-tests/phases/log/log.xml
+++ b/opendj-sdk/opends/tests/system-tests/phases/log/log.xml
@@ -49,13 +49,13 @@
       
       <!-- Create folders -->
       <call function="'createFolder'">
-        { 'location'   : STAF_LOCAL_HOSTNAME, 
+        { 'location'   : STAF_LOCAL_HOSTNAME,
           'foldername' : LOG_DIR,
           'fileFd'     : NO_FILE
         }
       </call>
       <call function="'createFolder'">
-        { 'location'   : STAF_LOCAL_HOSTNAME, 
+        { 'location'   : STAF_LOCAL_HOSTNAME,
           'foldername' : LOG_TMP_DIR,
           'fileFd'     : NO_FILE
         }
@@ -534,7 +534,57 @@
     </sequence>
   </function>
   
-
+  
+  <!-- ************************************************************ -->
+  <function name="writeStartTagClient" scope="local">
+   <function-prolog>
+      ''
+    </function-prolog>
+    <function-map-args>
+      <function-arg-def name="client" type="required">
+      </function-arg-def>
+      <function-arg-def name="fileFd" type="required">
+        <function-arg-description>
+          file descriptor
+        </function-arg-description>
+      </function-arg-def>
+    </function-map-args>
+    <sequence>
+      <if expr="fileFd != NO_FILE">
+        <script>
+          str = '\n&lt;client name=\"%s\"' % client.getName()
+          str = '%s id=\"%s\"'             % (str,client.getId())
+          str = '%s host=\"%s\"'           % (str,client.getHost())
+          str = '%s start=\"%s\"'          % (str,client.getStart())
+          str = '%s stop=\"%s\"'           % (str,client.getStop())
+          str = '%s dependency=\"%s\"&gt;\n' % (str,client.getDependency())
+          fileFd.write(str)
+        </script>
+      </if>
+    </sequence>
+  </function>
+  
+  <function name="writeEndTagClient" scope="local">
+   <function-prolog>
+      ''
+    </function-prolog>
+    <function-map-args>
+      <function-arg-def name="fileFd" type="required">
+        <function-arg-description>
+          file descriptor
+        </function-arg-description>
+      </function-arg-def>
+    </function-map-args>
+    <sequence>
+      <if expr="fileFd != NO_FILE">
+        <script>
+          fileFd.write('&lt;/client&gt;\n\n')
+        </script>
+      </if>
+    </sequence>
+  </function>
+  
+  
   <!-- ************************************************************ -->
   <function name="writeStartTagOperation" scope="local">
    <function-prolog>
diff --git a/opendj-sdk/opends/tests/system-tests/phases/main_run.xml b/opendj-sdk/opends/tests/system-tests/phases/main_run.xml
index b94ff65..7932315 100644
--- a/opendj-sdk/opends/tests/system-tests/phases/main_run.xml
+++ b/opendj-sdk/opends/tests/system-tests/phases/main_run.xml
@@ -261,7 +261,8 @@
               <call function="'preConfiguration'">
               { 
                 'instances' : instances,
-                'suffix'    : suffix
+                'suffix'    : suffix,
+                'scheduler' : scheduler
               }
               </call>
               <script>
@@ -308,7 +309,8 @@
               <call function="'postConfiguration'">
               { 
                 'instances' : instances,
-                'suffix'    : suffix
+                'suffix'    : suffix,
+                'scheduler' : scheduler
               }
               </call>
               <script>
diff --git a/opendj-sdk/opends/tests/system-tests/phases/scheduler/scheduler.xml b/opendj-sdk/opends/tests/system-tests/phases/scheduler/scheduler.xml
index c13c5b6..4bfcf87 100755
--- a/opendj-sdk/opends/tests/system-tests/phases/scheduler/scheduler.xml
+++ b/opendj-sdk/opends/tests/system-tests/phases/scheduler/scheduler.xml
@@ -174,15 +174,14 @@
             logFile = STAXResult
             fileList.append(logFile)
             fileFd = open(logFile,'w')
-            
-            # Write start tag
-            str = '\n&lt;client name=\"%s\"' % client.getName()
-            str = '%s host=\"%s\"'           % (str,client.getHost())
-            str = '%s start=\"%s\"'          % (str,client.getStart())
-            str = '%s stop=\"%s\"'           % (str,client.getStop())
-            str = '%s dependency=\"%s\"&gt;\n' % (str,client.getDependency())
-            fileFd.write(str)
           </script>
+          <!-- == Write tag for xml report -->
+          <call function="'writeStartTagClient'">
+          {
+            'client' : client,
+            'fileFd' : LOG_MAIN_FD 
+          }
+          </call>
           
           
           <!--== Start is NOT defined in client attribute ==-->
@@ -259,9 +258,12 @@
           </call>
           
           
+          <!-- == Write tag for xml report -->
+          <call function="'writeEndTagClient'">
+          { 'fileFd'    : LOG_MAIN_FD }
+          </call>
           <!--==== close logfile ====-->
           <script>
-            fileFd.write('&lt;/client&gt;\n')
             fileFd.close()
             fileFd = ''
           </script>
diff --git a/opendj-sdk/opends/tests/system-tests/report/result.xsl b/opendj-sdk/opends/tests/system-tests/report/result.xsl
index 1a348ba..5d0941f 100755
--- a/opendj-sdk/opends/tests/system-tests/report/result.xsl
+++ b/opendj-sdk/opends/tests/system-tests/report/result.xsl
@@ -500,6 +500,23 @@
             
           </li><br/><br/>
         </xsl:when>
+        <!--== client node ==-->
+        <xsl:when test="$nodeName = 'client'">
+          <xsl:variable name="clientName" select="normalize-space(@name)"/>
+          <xsl:variable name="clientHost" select="normalize-space(@host)"/>
+          <xsl:variable name="clientId" select="normalize-space(@id)"/>
+          <li>
+            <b>
+              <xsl:value-of select="$phaseName"/> for client
+              <font color="blue"><xsl:value-of select="$clientName"/></font>
+              (id <xsl:value-of select="$clientId"/>) 
+              on <xsl:value-of select="$clientHost"/>
+            </b><br/>
+            
+            <xsl:call-template name="parseChildPhase" />
+            
+          </li><br/><br/>
+        </xsl:when>
         <!--== phaseResult node ==-->
         <xsl:when test="$nodeName = 'phaseResult'">
         </xsl:when>
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample2/post_configuration.xml b/opendj-sdk/opends/tests/system-tests/scenario/sample2/post_configuration.xml
index 821a357..5389031 100644
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample2/post_configuration.xml
+++ b/opendj-sdk/opends/tests/system-tests/scenario/sample2/post_configuration.xml
@@ -41,6 +41,11 @@
           suffix class
         </function-arg-description>
       </function-arg-def>
+      <function-arg-def name="scheduler" type="required">
+        <function-arg-description>
+          suffix class
+        </function-arg-description>
+      </function-arg-def>
     </function-map-args>
     
     <sequence>
@@ -111,6 +116,34 @@
       </iterate>
       
       
+      <!-- ================= Display client names    ================ -->
+      <!--== Get the enabled clients list from all modules ==-->
+      <call function="'getEnabledClients'">{'scheduler':scheduler}</call>
+      <script>clients = STAXResult </script>
+      
+      <iterate in="clients" var="client">
+        <sequence>
+          <!-- == Write tag for xml report -->
+          <call function="'writeStartTagClient'">
+          {
+            'client' : client,
+            'fileFd' : LOG_MAIN_FD 
+          }
+          </call>
+          
+          <call function="'writeMessage'">
+          { 
+            'fileFd'  : LOG_MAIN_FD,
+            'content' : 'my client is : %s' % client.getName()
+          }
+          </call>
+          
+          <!-- == Write tag for xml report -->
+          <call function="'writeEndTagClient'">
+          { 'fileFd'    : LOG_MAIN_FD }
+          </call>
+        </sequence>
+      </iterate>
       
       
       <!-- ================= Call postambule ======================= -->
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample2/pre_configuration.xml b/opendj-sdk/opends/tests/system-tests/scenario/sample2/pre_configuration.xml
index 90db05b..5bec185 100644
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample2/pre_configuration.xml
+++ b/opendj-sdk/opends/tests/system-tests/scenario/sample2/pre_configuration.xml
@@ -41,6 +41,11 @@
           suffix class
         </function-arg-description>
       </function-arg-def>
+      <function-arg-def name="scheduler" type="required">
+        <function-arg-description>
+          suffix class
+        </function-arg-description>
+      </function-arg-def>
     </function-map-args>
     
     <sequence>
@@ -74,12 +79,38 @@
           <call function="'writeEndTagInstance'">
           { 'fileFd'    : LOG_MAIN_FD }
           </call>
-          
         </sequence>
       </iterate>
       
       
+      <!-- ================= Display client names    ================ -->
+      <!--== Get the enabled clients list from all modules ==-->
+      <call function="'getEnabledClients'">{'scheduler':scheduler}</call>
+      <script>clients = STAXResult </script>
       
+      <iterate in="clients" var="client">
+        <sequence>
+          <!-- == Write tag for xml report -->
+          <call function="'writeStartTagClient'">
+          {
+            'client' : client,
+            'fileFd' : LOG_MAIN_FD 
+          }
+          </call>
+          
+          <call function="'writeMessage'">
+          { 
+            'fileFd'  : LOG_MAIN_FD,
+            'content' : 'my client is : %s' % client.getName()
+          }
+          </call>
+          
+          <!-- == Write tag for xml report -->
+          <call function="'writeEndTagClient'">
+          { 'fileFd'    : LOG_MAIN_FD }
+          </call>
+        </sequence>
+      </iterate>
       
       <!-- ================= Call postambule ======================= -->
       <call function="'phasePostamble'">

--
Gitblit v1.10.0