From a53a0b38214c0bc708fa0e9c1e6a22aae4158ec0 Mon Sep 17 00:00:00 2001
From: Gary Williams <gary.williams@forgerock.com>
Date: Mon, 19 Mar 2012 17:59:33 +0000
Subject: [PATCH] Functional tests show tail of error log on stopping server

---
 opends/tests/staf-tests/shared/functions/dsadm.xml |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/opends/tests/staf-tests/shared/functions/dsadm.xml b/opends/tests/staf-tests/shared/functions/dsadm.xml
index 19f8906..8fc4cef 100755
--- a/opends/tests/staf-tests/shared/functions/dsadm.xml
+++ b/opends/tests/staf-tests/shared/functions/dsadm.xml
@@ -657,6 +657,15 @@
           STAFCmdParamsList.append('-H')
  
         STAFCmdParams=' '.join(STAFCmdParamsList)
+
+        from java.util import Date
+        from java.text import SimpleDateFormat
+        import re
+        
+        pattern=re.compile("\[(.*)\]")
+        formatter = SimpleDateFormat("dd/MMM/yy:H:m:s Z")
+
+        stop_current_time = Date()
       </script>
       
       <message>
@@ -700,6 +709,28 @@
           </else>
         </if>
       </if>
+
+      <!-- Get Errors log -->
+      <message>
+        'Getting tail of error log on %s/logs/errors' % dsPath
+      </message>
+      <call function="'getFile'">
+        { 'location'    : location,
+          'filename'    : '%s/logs/errors' % dsPath
+        }
+      </call>
+      <script>
+        for line in STAXResult[1].split('\n'):
+          mymatch = pattern.match(line)
+          if mymatch:
+            timestamp=mymatch.group(1)
+            timestamp_object = formatter.parse(timestamp)
+            if date_compare(stop_current_time,timestamp_object) == 'Less':
+              print line
+      </script>
+      <message>
+        'Result = %s' % STAXResult
+      </message>
     </sequence>
   </function>
 
@@ -1041,7 +1072,7 @@
       </call>
 
       <script>
-         savSTAXResult = STAXResult
+        savSTAXResult = STAXResult
         resultString = STAXResult[0][1]
       </script>
 

--
Gitblit v1.10.0