Factor out tail log file method in functional tests.
| | |
| | | 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> |
| | | |
| | |
| | | } |
| | | </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> |
| | | |
| | |
| | | "md5_hash" , |
| | | "value_not_string" , |
| | | "get_system_uid" , |
| | | "date_compare" |
| | | "date_compare" , |
| | | "tail_logfile" |
| | | ] |
| | | |
| | | class format_testcase: |
| | |
| | | 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 |