class CheckLoad

Public Class Methods

new(id, contents) click to toggle source
# File tools/multithread_check.rb, line 21
def initialize id, contents
  @id=id
  @contents = contents
  mycsv = CSV_MODULE::MyCSV.new('auxillary/testdata.csv')
  @queries = mycsv.get_queries
end

Public Instance Methods

call() click to toggle source
# File tools/multithread_check.rb, line 28
def call
  puts 'STARTED THREAD NUMBER: ' + @id.to_s

  r = Random.new
  @queries.each_with_index do |query, index|
    q = {}
    #q['content'] = query['content']
    q['content'] = @queries[r.rand(0..490)]['content']
    puts "QUERY TO SEND: '" + q['content'] + "'"

    url = "http://10.1.2.230:4567/sentra/analyzer/atomic?key=QD3F7Yr2u098RfaB"
    response = RestClient2.post(url, q.to_json)

    json = JSON.parse(response.body)
    puts "RECEIVED RESPONSE FROM THREAD: " + @id.to_s + " FOR CONTENT  '" + q['content'] + "' RESULT: " +
             json.to_s
  end
end