mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Gary Williams
20.27.2012 5646aa4bc17327cc799f2857c6f226ee72c83e16
Factor out tail log file method in functional tests.
2 files modified
35 ■■■■ changed files
opends/tests/staf-tests/shared/functions/dsadm.xml 17 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/shared/python/common.py 18 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/shared/functions/dsadm.xml
@@ -659,12 +659,6 @@
        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>
      
@@ -720,17 +714,8 @@
        }
      </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
        tail_logfile(STAXResult,stop_current_time)
      </script>
      <message>
        'Result = %s' % STAXResult
      </message>
    </sequence>
  </function>
opends/tests/staf-tests/shared/python/common.py
@@ -58,7 +58,8 @@
            "md5_hash" ,
            "value_not_string" ,
            "get_system_uid" ,
            "date_compare"
            "date_compare" ,
            "tail_logfile"
            ]
class format_testcase:
@@ -889,3 +890,18 @@
    return "Less"
  else:
    return "Equal"
def tail_logfile(log_file,from_time):
  from java.text import SimpleDateFormat
  import re
  pattern=re.compile("\[(.*)\]")
  formatter = SimpleDateFormat("dd/MMM/yy:H:m:s Z")
  for line in log_file[1].split('\n'):
    mymatch = pattern.match(line)
    if mymatch:
      timestamp=mymatch.group(1)
      timestamp_object = formatter.parse(timestamp)
      if date_compare(from_time,timestamp_object) == 'Less':
        print line