def do_method(self,method,element_type=None,*args): dao = DataAccessObject() t0 = time.time() self.logger.log("TIME0 = " + str(t0)) method(*args) result_time = time.time() - t0 self.logger.log("EXECUTION TIME = " + str(result_time) + " seconds") try: if element_type == profiling_events.login_event: self.logger.log("INSERT INTO LOGIN_TIMELINE_TABLE") dao.insert_into_login_timeline_table(result_time) elif element_type == profiling_events.message_sent_event: self.logger.log("INSERT INTO PROFILE_EVENTS_TABLE") dao.insert_into_send_message_timeline_table(result_time) elif element_type == profiling_events.questionary_edited_event: self.logger.log("INSERT INTO QUESTIONARY_TIMELINE_TABLE") dao.insert_into_questionary_timeline_table(result_time) elif element_type == profiling_events.user_marked_event: self.logger.log("INSERT INTO MARKS_TIMELINE_TABLE") dao.insert_into_mark_user_timeline_table(result_time) elif element_type == profiling_events.user_navigated_event: self.logger.log("INSERT INTO NAVIGATION_TIMELINE_TABLE") dao.insert_into_user_navigation_timeline_table(result_time) except TestFailedException as e: raise TestFailedException("Failed to put in log time metrics " + e.message)
def setup_database(self): dao = DataAccessObject() dao.create_login_timline_table() dao.create_mark_user_timeline_table() dao.create_user_navigation_timeline_table() dao.create_questionary_editing_timeline_table() dao.create_send_message_timeline_table() dao.create_buildhistory_table()
def refresh_view(self,environ,start_response): ResultHandler().generate_login_data_source_script() dao = DataAccessObject() builds = dao.get_buildhistory() start_response('200 Ok', [('content-type', 'application/json')]) return [json.dumps(builds)]