From 5e9bfceab96d52d52a63f8b67b2672422c32f1b1 Mon Sep 17 00:00:00 2001
From: Christophe Sovant <christophe.sovant@forgerock.com>
Date: Thu, 10 Sep 2009 15:08:16 +0000
Subject: [PATCH] Change formatting of the testcase html reports

---
 opends/tests/staf-tests/shared/xsl/gen-logs.xsl    |   30 +++++++++++++++++++++++++++++-
 opends/tests/staf-tests/shared/functions/utils.xml |   27 +++++++++++++--------------
 2 files changed, 42 insertions(+), 15 deletions(-)

diff --git a/opends/tests/staf-tests/shared/functions/utils.xml b/opends/tests/staf-tests/shared/functions/utils.xml
index d802604..d5c6f45 100755
--- a/opends/tests/staf-tests/shared/functions/utils.xml
+++ b/opends/tests/staf-tests/shared/functions/utils.xml
@@ -1699,9 +1699,6 @@
         _functionRC = int(RC)
         _functionResult = STAXResult
       </script>
-      <message log="1" level="'debug'">
-        'runFunction: %s: returned [%s] with [%s]' % (functionName,RC,STAXResult)
-      </message>
 
       <!-- this section handles the optional case when we need to set the 
            test case status
@@ -1917,15 +1914,6 @@
         cmdResult=STAXResult
       </script>
 
-      <if expr="expectedRC != 'noCheck'">
-        <call function="'checktestRC'">
-          { 'returncode' : cmdRC,
-            'result'     : cmdOutput,
-            'expected'   : expectedRC,
-            'issue'      : knownIssue
-          }
-        </call>
-      </if>
       <script>
         def dig(var):
           try:
@@ -1944,6 +1932,17 @@
         if stripOutput == True:
           cmdResult=dig(cmdResult)
       </script>
+
+      <if expr="expectedRC != 'noCheck'">
+        <call function="'checktestRC'">
+          { 'returncode' : cmdRC,
+            'result'     : cmdResult,
+            'expected'   : expectedRC,
+            'issue'      : knownIssue
+          }
+        </call>
+      </if>
+      
       <return>
         cmdResult
       </return>
@@ -2402,7 +2401,7 @@
       </function-arg-def>      
       <function-arg-def name="expectedRC" type="optional" default="0">
         <function-arg-description>
-          Expected return code value. 
+          Expected return code value.
           0 for successful grep, 1 for unsuccessful grep. Default value is 0.
           Wildcard 'noCheck' to not check the RC
         </function-arg-description>
@@ -2428,7 +2427,7 @@
           env = ['%s' % cp]        
         else:
           cmd = '%s/bin/javac' % JAVA_HOME
-          env = ['JAVA_HOME=%s' % JAVA_HOME, '%s' % cp]          
+          env = ['JAVA_HOME=%s' % JAVA_HOME, '%s' % cp]
       </script>
 
       <call function="'listFolderByExtension'" >
diff --git a/opends/tests/staf-tests/shared/xsl/gen-logs.xsl b/opends/tests/staf-tests/shared/xsl/gen-logs.xsl
index 60c189e..9e6adb8 100644
--- a/opends/tests/staf-tests/shared/xsl/gen-logs.xsl
+++ b/opends/tests/staf-tests/shared/xsl/gen-logs.xsl
@@ -29,6 +29,32 @@
 
 <xsl:output method="html" version="4.0" encoding="iso-8859-1" indent="yes"/>
 
+<xsl:template name="br-replace">
+  <xsl:param name="text"/>
+  <xsl:variable name="cr" select="'\n'"/>
+  <xsl:choose>
+    <!-- If the value of the $text parameter
+            contains a carriage return... -->
+    <xsl:when test="contains($text,$cr)">
+      <!-- Return the substring of $text before the carriage return -->
+      <xsl:value-of select="substring-before($text,$cr)"/>
+      <!-- And construct a <br/> element -->
+      <br/>
+      <!--
+       | Then invoke this same br-replace template again, passing the
+       | substring *after* the carriage return as the new "$text" to
+       | consider for replacement
+       +-->
+      <xsl:call-template name="br-replace">
+        <xsl:with-param name="text" select="substring-after($text,$cr)"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$text"/>
+    </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
 <xsl:template match="/">
   
   <xsl:element name="html">
@@ -165,7 +191,9 @@
             </xsl:choose>
           </xsl:element>
           <xsl:element name="td">
-            <xsl:value-of select="@message"/>
+            <xsl:call-template name="br-replace">
+              <xsl:with-param name="text" select="@message"/>
+            </xsl:call-template>
           </xsl:element>
         </xsl:element>
 

--
Gitblit v1.10.0