From bf018d72cb10eb078c61c14ba4cb8befea74c7be Mon Sep 17 00:00:00 2001
From: Christophe Sovant <christophe.sovant@forgerock.com>
Date: Fri, 22 Mar 2013 17:33:01 +0000
Subject: [PATCH] CR-1459 Update svn properties, snmp tests and add a script to merge tests results 

---
 opends/tests/staf-tests/shared/xsl/junit-report.xsl                                |   48 +++++++++++++++---------
 opends/tests/staf-tests/functional-tests/testcases/replication/replication.xml     |    1 
 opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_setup.xml             |    4 +-
 opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic_tests.xml |   14 +++---
 opends/tests/staf-tests/shared/xsl/merge_results.xsl                               |   45 ++++++++++++++++++++++
 5 files changed, 85 insertions(+), 27 deletions(-)

diff --git a/opends/tests/staf-tests/functional-tests/testcases/replication/replication.xml b/opends/tests/staf-tests/functional-tests/testcases/replication/replication.xml
index 689bf6c..13c9c07 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/replication/replication.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/replication/replication.xml
@@ -24,6 +24,7 @@
  ! CDDL HEADER END
  !
  !      Copyright 2007-2010 Sun Microsystems, Inc.
+ !      Portions Copyright 2013 ForgeRock AS
  ! -->
 <stax>
   <defaultcall function="main_replication"/>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic_tests.xml
index 00e0059..bdce0bd 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic_tests.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic_tests.xml
@@ -1396,7 +1396,7 @@
 
             <call function="'searchString'">
               {
-              'expectedString' : '0.0.0.0:%s : SNMP     : Enabled' \
+              'expectedString' : '0.0.0.0:%s\\s+:\\s+SNMP\\s+:\\s+Enabled' \
                                  % SNMP_PORT ,
               'returnString'   : returnString ,
               'expectedRC'     : 0
@@ -1435,7 +1435,7 @@
 
             <call function="'searchString'">
               {
-              'expectedString' : '0.0.0.0:%s : SNMP     : Enabled' \
+              'expectedString' : '0.0.0.0:%s\\s+:\\s+SNMP\\s+:\\s+Enabled' \
                                  % SNMP_PORT ,
               'returnString'   : returnString ,
               'expectedRC'     : 0
@@ -1531,7 +1531,7 @@
 
             <call function="'searchString'">
               {
-              'expectedString' : '0.0.0.0:%s : SNMP     : Disabled' \
+              'expectedString' : '0.0.0.0:%s\\s+:\\s+SNMP\\s+:\\s+Disabled' \
                                  % SNMP_PORT ,
               'returnString'   : returnString ,
               'expectedRC'     : 0
@@ -1586,7 +1586,7 @@
 
             <call function="'searchString'">
               {
-              'expectedString' : '0.0.0.0:%s : SNMP     : Enabled' \
+              'expectedString' : '0.0.0.0:%s\\s+:\\s+SNMP\\s+:\\s+Enabled' \
                                  % SNMP_PORT ,
               'returnString'   : returnString ,
               'expectedRC'     : 0
@@ -1738,7 +1738,7 @@
 
             <call function="'searchString'">
               {
-              'expectedString' : '0.0.0.0:%s : SNMP     : Enabled' \
+              'expectedString' : '0.0.0.0:%s\\s+:\\s+SNMP\\s+:\\s+Enabled' \
                                  % SNMP_PORT ,
               'returnString'   : returnString ,
               'expectedRC'     : 0
@@ -1930,7 +1930,7 @@
 
             <call function="'searchString'">
               {
-              'expectedString' : '0.0.0.0:%s : SNMP     : Enabled' \
+              'expectedString' : '0.0.0.0:%s\\s+:\\s+SNMP\\s+:\\s+Enabled' \
                                  % SNMP_PORT ,
               'returnString'   : returnString ,
               'expectedRC'     : 0
@@ -2111,7 +2111,7 @@
 
                 <call function="'searchString'">
                   {
-                  'expectedString' : '0.0.0.0:%s  : SNMP     : Enabled' \
+                  'expectedString' : '0.0.0.0:%s\\s+:\\s+SNMP\\s+:\\s+Enabled' \
                                      % DEFAULT_PROPERTIES['listen-port'] ,
                   'returnString'   : returnString ,
                   'expectedRC'     : 0
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_setup.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_setup.xml
index aa28cc7..a07963f 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_setup.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_setup.xml
@@ -330,7 +330,7 @@
                       <call function="'checktestString'">
                         {
                         'returnString'   : returnString ,
-                        'expectedString' : ': SNMP     : Disabled'
+                        'expectedString' : ':\\s+SNMP\\s+:\\s+Disabled'
                         }
                       </call>
 
@@ -445,7 +445,7 @@
                       <call function="'checktestString'">
                         {
                         'returnString'   : returnString ,
-                        'expectedString' : ': SNMP     : Enabled'
+                        'expectedString' : ':\\s+SNMP\\s+:\\s+Enabled'
                         }
                       </call>
 
diff --git a/opends/tests/staf-tests/shared/xsl/junit-report.xsl b/opends/tests/staf-tests/shared/xsl/junit-report.xsl
index 8b8445e..690aa02 100644
--- a/opends/tests/staf-tests/shared/xsl/junit-report.xsl
+++ b/opends/tests/staf-tests/shared/xsl/junit-report.xsl
@@ -23,7 +23,7 @@
  !
  ! CDDL HEADER END
  !
- !      Copyright 2011 ForgeRock AS.
+ !      Copyright 2011-2013 ForgeRock AS.
  ! -->
 
 <xsl:output method="xml" indent="yes" />
@@ -38,27 +38,39 @@
   <xsl:variable name="total-tests"      select="count($testcase)"/>
   <xsl:variable name="pass-tests"       select="count($testcase[@result='pass'])"/>
   <xsl:variable name="kfail-tests"      select="count($testcase/issues)"/>
-  <xsl:variable name="fail-tests"       select="count($testcase[@result='fail'])"/>
   <xsl:variable name="inconc-tests"     select="count($testcase[@result='unknown'])"/>
+  <xsl:variable name="fail-tests"       select="count($testcase[@result='fail']) - $kfail-tests"/>
   <testsuite name="opendj.tests.functional"
-    tests="{$total-tests}" time="0"
-    failures="{$fail-tests}" errors="0"
-    skipped="{$inconc-tests}">
-    
+             time="0"
+             tests="{$total-tests}"
+             errors="{$inconc-tests}"
+             failures="{$fail-tests}"
+             skipped="{$kfail-tests}">
+
     <xsl:for-each select="$testcase">
+      <xsl:variable name="issue">
+        <xsl:value-of select="issues/issue/@id"/>
+      </xsl:variable>
       <xsl:variable name="message" select="'no message'"/>
-      <xsl:variable name="className" select="$testsuite/@name"/>
-        <xsl:variable name="outcome" select="@result"/>
-        <testcase classname="opendj.tests.functional"
-          name="{@name}"
-          time="{@duration}">
-          
-          <xsl:if test="contains(@result, 'fail')">
-            <failure>
-              <xsl:value-of select="$message" />
-            </failure>
-          </xsl:if>
-        </testcase>
+      <testcase classname="{ancestor::testgroup[1]/@name}.{ancestor::testsuite[1]/@shortname}" 
+      			name="{@shortname}"
+      			time="{@duration}">
+        <xsl:if test="contains(@result, 'unknown')">
+          <error>
+            <xsl:value-of select="'log inconclusive'"/>
+          </error>
+        </xsl:if>
+        <xsl:if test="contains(@result, 'fail') and string-length($issue) = 0">
+          <failure>
+            <xsl:value-of select="'log fail'"/>
+          </failure>
+        </xsl:if>
+        <xsl:if test="contains(@result, 'fail') and string-length($issue) &gt; 0">
+          <skipped>
+            <xsl:value-of select="$issue"/>
+          </skipped>
+        </xsl:if>
+      </testcase>
     </xsl:for-each>
   
   </testsuite>
diff --git a/opends/tests/staf-tests/shared/xsl/merge_results.xsl b/opends/tests/staf-tests/shared/xsl/merge_results.xsl
new file mode 100644
index 0000000..c14a1da
--- /dev/null
+++ b/opends/tests/staf-tests/shared/xsl/merge_results.xsl
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<!--
+ ! 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/CDDLv1_0.txt
+ ! or http://forgerock.org/license/CDDLv1.0.html.
+ ! 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/CDDLv1_0.txt.  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
+ !
+ !      Copyright 2013 ForgeRock AS.
+ ! -->
+    <xsl:output method="xml" indent="yes"/>
+
+    <xsl:param name="filetomerge"/>
+
+    <xsl:template match="/">
+        <xsl:element name="qa">
+            <xsl:element name="functional-tests">
+                <xsl:copy-of select="/qa/functional-tests/identification"/>
+                <xsl:element name="results">
+                    <xsl:copy-of select="/qa/functional-tests/results/*"/>
+                    <xsl:copy-of select="document($filetomerge)/qa/functional-tests/results/*"/>
+                </xsl:element>
+            </xsl:element>
+        </xsl:element>
+
+    </xsl:template>
+</xsl:stylesheet>
+

--
Gitblit v1.10.0