Class/Module Index [+]

Quicksearch

Fluent::Test::InputTestDriver

Attributes

emit_streams[R]

Public Class Methods

new(klass, &block) click to toggle source
# File lib/fluent/test/input_test.rb, line 23
def initialize(klass, &block)
  super(klass, &block)
  @emit_streams = []
  @expects = nil
end

Public Instance Methods

emits() click to toggle source
# File lib/fluent/test/input_test.rb, line 40
def emits
  all = []
  @emit_streams.each {|tag,events|
    events.each {|time,record|
      all << [tag, time, record]
    }
  }
  all
end
events() click to toggle source
# File lib/fluent/test/input_test.rb, line 50
def events
  all = []
  @emit_streams.each {|tag,events|
    all.concat events
  }
  all
end
expect_emit(tag, time, record) click to toggle source
# File lib/fluent/test/input_test.rb, line 29
def expect_emit(tag, time, record)
  (@expects ||= []) << [tag, time, record]
  self
end
expected_emits() click to toggle source
# File lib/fluent/test/input_test.rb, line 34
def expected_emits
  @expects ||= []
end
records() click to toggle source
# File lib/fluent/test/input_test.rb, line 58
def records
  all = []
  @emit_streams.each {|tag,events|
    events.each {|time,record|
      all << record
    }
  }
  all
end
run(&block) click to toggle source
# File lib/fluent/test/input_test.rb, line 68
def run(&block)
  m = method(:emit_stream)
  super {
    Engine.define_singleton_method(:emit_stream) {|tag,es|
      m.call(tag, es)
    }

    block.call if block

    if @expects
      i = 0
      @emit_streams.each {|tag,events|
        events.each {|time,record|
          assert_equal(@expects[i], [tag, time, record])
          i += 1
        }
      }
      assert_equal @expects.length, i
    end
  }
  self
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.