Sha256: 775edd5e30d492e285f0798e356b5044f517a95aa98c858322e7620ff3d4327e

Contents?: true

Size: 1.19 KB

Versions: 58

Compression:

Stored size: 1.19 KB

Contents

require 'set'

module Bench
  class Result
    attr_accessor :last_response,:time,:marker,:url,:verb,:error,:verification_error
    include Logging
    include Utils
    
    def initialize(marker,verb,url,thread_id,iteration)
      @marker,@verb,@url,@thread_id,@iteration = marker,verb,url,thread_id,iteration
      @verification_error = 0
      @time = 0
    end
    
    def code
      @last_response.code
    end
    
    def body
      @last_response.to_s
    end
    
    def cookies
      @last_response.cookies
    end
    
    def headers
      @last_response.headers
    end
    
    def verify_body(expected)
      expected,actual = JSON.parse(expected),JSON.parse(@last_response.to_s)    
      @verification_error += compare_and_log(expected,actual,caller(1)[0].to_s)
    end
    
    def verify_code(expected)
      if expected != @last_response.code
        bench_log "#{log_prefix} Verify error at: " + caller(1)[0].to_s
        bench_log "#{log_prefix} Code diff: "
        bench_log "#{log_prefix} expected: #{expected.inspect}"
        bench_log "#{log_prefix} but got:  #{@last_response.code}"
        @verification_error += 1
      end
    end
    
    def verify_headers
      
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
rhoconnect-3.2.0.beta3 bench/lib/bench/result.rb
rhoconnect-3.2.0.beta2 bench/lib/bench/result.rb
rhoconnect-3.2.0.beta1 bench/lib/bench/result.rb
rhoconnect-3.1.2 bench/lib/bench/result.rb
rhoconnect-3.1.1 bench/lib/bench/result.rb
rhoconnect-3.1.0 bench/lib/bench/result.rb
rhoconnect-3.1.0.beta2 bench/lib/bench/result.rb
rhoconnect-3.1.0.beta1 bench/lib/bench/result.rb
rhoconnect-3.0.6 bench/lib/bench/result.rb
rhoconnect-3.0.5 bench/lib/bench/result.rb
rhoconnect-3.0.4 bench/lib/bench/result.rb
rhoconnect-3.0.3 bench/lib/bench/result.rb
rhoconnect-3.0.2 bench/lib/bench/result.rb
rhoconnect-3.0.1 bench/lib/bench/result.rb
rhoconnect-3.0.0 bench/lib/bench/result.rb
rhoconnect-3.0.0.rc1 bench/lib/bench/result.rb
rhoconnect-3.0.0.beta3 bench/lib/bench/result.rb
rhoconnect-3.0.0.beta1 bench/lib/bench/result.rb