#NEWLINE# def PopulateData( token = None ) : #NEWLINE# #INDENT# 'Populates some usage information into the data store.' #NEWLINE# flows = [ 'ListDirectory' , 'GetFile' , 'Flow1' , 'KillFlow' , 'Interrogate' ] #NEWLINE# def SimulateUserActivity( username , client_id , timestamp , num = 10 ) : #NEWLINE# #INDENT# for flow_name in flows [ : num ] : #NEWLINE# #INDENT# event = flow . AuditEvent ( user = username , action = 'RUN_FLOW' , flow_name = flow_name , client = client_id , age = timestamp ) #NEWLINE# flow . Events . PublishEvent ( 'Audit' , event , token = token ) #NEWLINE# #UNINDENT# #UNINDENT# now = int ( rdfvalue . RDFDatetime ( ) . Now ( ) ) #NEWLINE# week_duration = ( ( ( ( 7 * 24 ) * 60 ) * 60 ) * 1000000.0 ) #NEWLINE# SimulateUserActivity ( 'test' , 'C.0000000000000001' , now ) #NEWLINE# SimulateUserActivity ( 'test' , 'C.0000000000000002' , now ) #NEWLINE# SimulateUserActivity ( 'admin' , 'C.0000000000000001' , now ) #NEWLINE# SimulateUserActivity ( 'user' , 'C.0000000000000003' , now ) #NEWLINE# SimulateUserActivity ( 'test' , 'C.0000000000000001' , ( now - week_duration ) ) #NEWLINE# SimulateUserActivity ( 'admin' , 'C.0000000000000001' , ( now - week_duration ) ) #NEWLINE# SimulateUserActivity ( 'user' , 'C.0000000000000001' , ( now - ( 2 * week_duration ) ) ) #NEWLINE# SimulateUserActivity ( 'admin' , 'C.0000000000000001' , ( week_duration - ( 2 * week_duration ) ) ) #NEWLINE# test_lib . MockWorker ( token = token ) . Simulate ( )