Sha256: 23a219a25c38e5b144860cc8b0671fae2b7a8befec0b7ff1e9fc3124500e0cc8

Contents?: true

Size: 1.18 KB

Versions: 83

Compression:

Stored size: 1.18 KB

Contents

require "stud/temporary"


# namespace the Dummy* classes, they are reused names
# use a more specific module name to prevent clashes
module BeatsInputTest
  class Certicate
    attr_reader :ssl_key, :ssl_cert

    def initialize
      @ssl_cert = Stud::Temporary.pathname("ssl_certificate")
      @ssl_key = Stud::Temporary.pathname("ssl_key")

      system("openssl req -x509  -batch -nodes -newkey rsa:2048 -keyout #{ssl_key} -out #{ssl_cert} -subj /CN=localhost > /dev/null 2>&1")
    end
  end

  class << self
    def certificate
      Certicate.new
    end

    def random_port
      rand(2000..10000)
    end
  end

  class DummyNeverBlockedQueue < Array
    def offer(element, timeout = nil)
      push(element)
    end

    alias_method :take, :shift
  end

  class DummyConnection
    def initialize(events)
      @events = events
    end

    def run
      @events.each do |element|
        yield element[:map], element[:identity_stream]
      end
    end

    def peer
      "localhost:5555"
    end
  end

  class DummyCodec
    def register() end
    def decode(*) end
    def clone() self; end
    def base_codec
      self
    end
    def self.config_name
      "dummy"
    end
  end
end



Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
logstash-input-beats-5.1.11-java spec/support/logstash_test.rb
logstash-input-beats-5.1.10-java spec/support/logstash_test.rb
logstash-input-beats-6.0.11-java spec/support/logstash_test.rb
logstash-input-beats-6.0.10-java spec/support/logstash_test.rb
logstash-input-beats-6.0.9-java spec/support/logstash_test.rb
logstash-input-beats-6.0.8-java spec/support/logstash_test.rb
logstash-input-beats-6.0.7-java spec/support/logstash_test.rb
logstash-input-beats-6.0.6-java spec/support/logstash_test.rb
logstash-input-beats-6.0.5-java spec/support/logstash_test.rb
logstash-input-beats-6.0.4-java spec/support/logstash_test.rb
logstash-input-beats-6.0.3-java spec/support/logstash_test.rb
logstash-input-beats-5.1.9-java spec/support/logstash_test.rb
logstash-input-beats-6.0.2-java spec/support/logstash_test.rb
logstash-input-beats-6.0.1-java spec/support/logstash_test.rb
logstash-input-beats-6.0.0-java spec/support/logstash_test.rb
logstash-input-beats-5.1.8-java spec/support/logstash_test.rb
logstash-input-beats-5.1.7-java spec/support/logstash_test.rb
logstash-input-beats-5.1.6-java spec/support/logstash_test.rb
logstash-input-beats-5.1.5-java spec/support/logstash_test.rb
logstash-input-beats-5.1.4-java spec/support/logstash_test.rb