From 915897b2a0bc7acfc4e5045c09ea14122f18ecab Mon Sep 17 00:00:00 2001
From: andrug <andrug@localhost>
Date: Tue, 06 May 2008 16:30:33 +0000
Subject: [PATCH] allow report to display links + add a new xsl to parse client details log

---
 opendj-sdk/opends/tests/system-tests/phases/scheduler/scheduler.xml                                 |   14 ++++
 opendj-sdk/opends/tests/system-tests/report/result.xsl                                              |   20 +++++-
 opendj-sdk/opends/tests/system-tests/phases/main_run_lib.xml                                        |   10 +++
 opendj-sdk/opends/tests/system-tests/scenario/sample2/clients/sampleSearchLoad/sampleSearchLoad.xml |    1 
 opendj-sdk/opends/tests/system-tests/clients/modifyLoad/modifyLoad.xml                              |    1 
 opendj-sdk/opends/tests/system-tests/phases/main_run.xml                                            |    3 
 opendj-sdk/opends/tests/system-tests/report/clientDetails.xsl                                       |   88 +++++++++++++++++++++++++++++
 opendj-sdk/opends/tests/system-tests/clients/searchLoad/searchLoad.xml                              |    1 
 opendj-sdk/opends/tests/system-tests/phases/log/log.xml                                             |   24 +++++++
 9 files changed, 152 insertions(+), 10 deletions(-)

diff --git a/opendj-sdk/opends/tests/system-tests/clients/modifyLoad/modifyLoad.xml b/opendj-sdk/opends/tests/system-tests/clients/modifyLoad/modifyLoad.xml
index adae869..2bee92f 100755
--- a/opendj-sdk/opends/tests/system-tests/clients/modifyLoad/modifyLoad.xml
+++ b/opendj-sdk/opends/tests/system-tests/clients/modifyLoad/modifyLoad.xml
@@ -260,6 +260,7 @@
           <!-- ========== Postamble ========== -->
           <call function="'writeMessage'">
           {'content' : 'Output file %s' % outFile,
+           'xlink'   : outFile,
            'fileFd'  : fileFd}
           </call>
           
diff --git a/opendj-sdk/opends/tests/system-tests/clients/searchLoad/searchLoad.xml b/opendj-sdk/opends/tests/system-tests/clients/searchLoad/searchLoad.xml
index 899ac4b..a9d06fa 100755
--- a/opendj-sdk/opends/tests/system-tests/clients/searchLoad/searchLoad.xml
+++ b/opendj-sdk/opends/tests/system-tests/clients/searchLoad/searchLoad.xml
@@ -258,6 +258,7 @@
           <!-- ========== Postamble ========== -->
           <call function="'writeMessage'">
           {'content' : 'Output file %s' % outFile,
+           'xlink'   : outFile,
            'fileFd'  : fileFd}
           </call>
           
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 d7589cb..b41c722 100755
--- a/opendj-sdk/opends/tests/system-tests/phases/log/log.xml
+++ b/opendj-sdk/opends/tests/system-tests/phases/log/log.xml
@@ -379,6 +379,11 @@
           string to write in a file
         </function-arg-description>
       </function-arg-def>
+      <function-arg-def name="xlink" type="optional" default="NOT_DEFINED">
+        <function-arg-description>
+          if you want the content to be a href of xlink
+        </function-arg-description>
+      </function-arg-def>
       <function-arg-def name="fileFd" type="required">
         <function-arg-description>
           file descriptor
@@ -392,7 +397,13 @@
           sys.path.append("%s/phases/log" % TESTS_DIR )
           from log import htmlTransformation
           content = htmlTransformation(content)
-          fileFd.write('&lt;message&gt;%s&lt;/message&gt;\n' % content)
+          if xlink == NOT_DEFINED:
+            str = '&lt;message&gt;'
+          else:
+            str = '&lt;message xlink:href="%s" xlink:type="simple"&gt;' % xlink
+          
+          str = '%s %s&lt;/message&gt;\n' % (str,content)
+          fileFd.write(str)
         </script>
       <else>
         <message>content</message>
@@ -543,6 +554,12 @@
     <function-map-args>
       <function-arg-def name="client" type="required">
       </function-arg-def>
+      <function-arg-def name="extraParameters" type="optional"
+                                               default="NOT_DEFINED">
+        <function-arg-description>
+          extra parameters to add in the node
+        </function-arg-description>
+      </function-arg-def>
       <function-arg-def name="fileFd" type="required">
         <function-arg-description>
           file descriptor
@@ -557,7 +574,10 @@
           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())
+          str = '%s dependency=\"%s\"'     % (str,client.getDependency())
+          if extraParameters != NOT_DEFINED:
+            str = '%s %s' % (str,extraParameters)
+          str = '%s &gt;\n' % str
           fileFd.write(str)
         </script>
       </if>
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 ba173bb..43f0b94 100644
--- a/opendj-sdk/opends/tests/system-tests/phases/main_run.xml
+++ b/opendj-sdk/opends/tests/system-tests/phases/main_run.xml
@@ -176,7 +176,8 @@
         str = '%s standalone=\"no\"?&gt;\n' % str
         str = '%s &lt;?xml-stylesheet type="text/xsl" href="result.xsl"?>\n' \
                % str
-        str = '%s &lt;systemTestRoot&gt;\n' % str
+        str = '%s &lt;systemTestRoot' % str
+        str = '%s xmlns:xlink="http://www.w3.org/1999/xlink"&gt;\n' % str
         LOG_MAIN_FD.write(str)
       </script>
       
diff --git a/opendj-sdk/opends/tests/system-tests/phases/main_run_lib.xml b/opendj-sdk/opends/tests/system-tests/phases/main_run_lib.xml
index 4bb34d9..dbe6ecd 100644
--- a/opendj-sdk/opends/tests/system-tests/phases/main_run_lib.xml
+++ b/opendj-sdk/opends/tests/system-tests/phases/main_run_lib.xml
@@ -457,6 +457,16 @@
       }
       </call>
       
+      <!--== Copy xsl file needed to read the client details ==-->
+      <call function="'copyFile'">
+      {
+        'srcFile'    : '%s/report/clientDetails.xsl' % (TESTS_DIR),
+        'destFile'   : '%s/tmp/clientDetails.xsl' % LOG_DIR,
+        'remoteHost' : STAXServiceMachine,
+        'fileFd'     : NO_FILE
+      }
+      </call>
+      
       <!--== Close main output file ==-->
       <script>
         LOG_MAIN_FD.write('&lt;/systemTestRoot&gt;\n')
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 9cfccb8..2058290 100755
--- a/opendj-sdk/opends/tests/system-tests/phases/scheduler/scheduler.xml
+++ b/opendj-sdk/opends/tests/system-tests/phases/scheduler/scheduler.xml
@@ -404,12 +404,14 @@
       <call function="'writeMessage'">
       { 
         'content' : 'Details of the client : %s' % logFileDetails,
+        'xlink'   : logFileDetails,
         'fileFd'  : fileFd
       }
       </call>
       <call function="'writeMessage'">
       { 
         'content' : 'Client outPuts : %s' % outFile,
+        'xlink'   : outFile,
         'fileFd'  : fileFd
       }
       </call>
@@ -457,10 +459,18 @@
       
       <!-- ==== Log info ====================================-->
       <!--== Write root tag for xml details file -->
+      <script>
+        str = '&lt;?xml version=\"1.0\" encoding=\"UTF-8\"'
+        str = '%s standalone=\"no\"?&gt;\n' % str
+        str = '%s &lt;?xml-stylesheet type="text/xsl"' % str
+        str = '%s href="clientDetails.xsl"?>\n' % str
+        fileFd.write(str)
+      </script>
       <call function="'writeStartTagClient'">
       {
-        'client' : client,
-        'fileFd' : fileFd
+        'client'          : client,
+        'extraParameters' : 'xmlns:xlink="http://www.w3.org/1999/xlink"',
+        'fileFd'          : fileFd
       }
       </call>
       
diff --git a/opendj-sdk/opends/tests/system-tests/report/clientDetails.xsl b/opendj-sdk/opends/tests/system-tests/report/clientDetails.xsl
new file mode 100644
index 0000000..dec2607
--- /dev/null
+++ b/opendj-sdk/opends/tests/system-tests/report/clientDetails.xsl
@@ -0,0 +1,88 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:xlink="http://www.w3.org/1999/xlink"
+                exclude-result-prefixes="xlink"           
+                version="1.0">
+  <xsl:output method="html"/>
+
+  <!-- ================= root node ================ -->
+  <xsl:template match="client">
+    <html><body>
+    <head>
+      <link href="../result.css" rel="stylesheet" type="text/css"></link>
+    </head>
+      
+    <h1>
+      Details for client 
+      <xsl:value-of select="@name" />
+      ( id <xsl:value-of select="@id" /> )
+    </h1>
+    <p>
+      <ul>
+      <xsl:apply-templates select="operation"/>
+      </ul>
+      <xsl:apply-templates select="message"/>
+    </p>
+    </body>
+    </html>
+  </xsl:template>
+
+  <!-- ============= operation node =============== -->
+  <xsl:template match="operation">
+    <xsl:variable name="opName" select="normalize-space(@name)"/>
+    <xsl:variable name="opDate" select="normalize-space(@date)"/>
+    <li>
+      <b><xsl:value-of select="$opName"/></b>
+         <i>@ <xsl:value-of select="$opDate"/></i><br/>
+      <xsl:apply-templates select="message"/>
+      <xsl:apply-templates select="operationResult"/>
+    </li>
+  </xsl:template>
+
+
+  <!-- ============= message node =============== -->
+  <xsl:template match="message">
+    <xsl:choose>
+      <xsl:when test="@xlink:href">
+        <a href="{@xlink:href}"><xsl:value-of select="." /></a>
+      </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="." />
+        </xsl:otherwise>
+      </xsl:choose>
+     <br/>
+  </xsl:template>
+
+  <!-- ============= operationResult node =============== -->
+  <xsl:template match="operationResult">
+    <xsl:variable name="rc" select="normalize-space(@returncode)"/>
+    <xsl:variable name="exprc" select="normalize-space(@expected)"/>
+    <xsl:variable name="result" select="normalize-space(.)"/>
+    <xsl:variable name="status" select="normalize-space(@status)"/>
+    
+    <b>
+      <xsl:choose>
+        <xsl:when test="$status='SUCCESS'">
+          <span class="pass"><xsl:value-of select="$status"/></span>
+          [
+           return code <xsl:value-of select="$rc" />,
+           expected <xsl:value-of select="$exprc" />
+          ] <br/>
+        </xsl:when>
+        <xsl:when test="$status='ERROR'">
+          <span class="fail"><xsl:value-of select="$status"/></span>
+          [
+           return code <xsl:value-of select="$rc" />,
+           expected <xsl:value-of select="$exprc" />,
+           <xsl:value-of select="$result" /> 
+          ] <br/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$status"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </b>
+  </xsl:template>
+
+
+  </xsl:stylesheet>
+
diff --git a/opendj-sdk/opends/tests/system-tests/report/result.xsl b/opendj-sdk/opends/tests/system-tests/report/result.xsl
index d1c9884..1ef66d8 100755
--- a/opendj-sdk/opends/tests/system-tests/report/result.xsl
+++ b/opendj-sdk/opends/tests/system-tests/report/result.xsl
@@ -24,8 +24,10 @@
  !
  !      Copyright 2008 Sun Microsystems, Inc.
  ! -->
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:xlink="http://www.w3.org/1999/xlink"
+                exclude-result-prefixes="xlink"           
+                version="1.0">
 <xsl:output 
   method="html"
   encoding="ISO-8859-1"
@@ -456,7 +458,7 @@
   * <a href="#summary"> Move up to Summary</a>
   <br/>
   * <a onclick="ShowHideListElement('{$phaseName}')">
-    <span class="showLink"> Clic me to show/hide details</span>
+    <span class="showLink"> Click me to show/hide details</span>
   </a>
   <p id="{$phaseName}" style="display: none">
     <ul>
@@ -517,7 +519,7 @@
     </ul>
     
   * <a onclick="ShowHideListElement('{$phaseName}')">
-    <span class="showLink">Clic me to show/hide details</span>
+    <span class="showLink">Click me to show/hide details</span>
   </a><br/>
   * <a href="#summary">Move up to Summary</a>
   </p>
@@ -707,7 +709,15 @@
 
 <!-- ================= Manage message node     ================ -->
 <xsl:template name="displayMessage">
-  <xsl:value-of select="." /> <br/>
+  <xsl:choose>
+    <xsl:when test="@xlink:href">
+      <a href="{@xlink:href}"><xsl:value-of select="." /></a>
+    </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="." />
+      </xsl:otherwise>
+    </xsl:choose>
+   <br/>
   <xsl:call-template name="parseChildPhase" />
 </xsl:template>
 
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample2/clients/sampleSearchLoad/sampleSearchLoad.xml b/opendj-sdk/opends/tests/system-tests/scenario/sample2/clients/sampleSearchLoad/sampleSearchLoad.xml
index f90e208..725c265 100755
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample2/clients/sampleSearchLoad/sampleSearchLoad.xml
+++ b/opendj-sdk/opends/tests/system-tests/scenario/sample2/clients/sampleSearchLoad/sampleSearchLoad.xml
@@ -259,6 +259,7 @@
           <!-- ========== Postamble ========== -->
           <call function="'writeMessage'">
           {'content' : 'Output file %s' % outFile,
+           'xlink'   : outFile,
            'fileFd'  : fileFd}
           </call>
           

--
Gitblit v1.10.0