Sha256: 657bab112f2bb60e007c3b8b2f70b952682810095ac78ee7c4c0d4f77d267e26

Contents?: true

Size: 1.87 KB

Versions: 34

Compression:

Stored size: 1.87 KB

Contents

module Flydata::SourceMysql::PluginSupport
  shared_context "query handler context" do
    let(:target_database) { "testdb" }
    let(:database) { target_database }
    let(:table) { "foo" }
    let(:seq) { 200 }
    let(:binlog_pos_string) { "mysql-bin.000065\t120" }
    let(:binlog_pos_object) { FlydataCore::Mysql::BinlogPos.new(binlog_pos_string) }
    let(:sync_fm) do
      r = double('sync_fm')
      allow(r).to receive(:get_table_source_raw_pos).and_return(binlog_pos_string)
      allow(r).to receive(:increment_and_save_table_position).with(table).and_yield(seq).and_return(nil)
      allow(r).to receive(:get_table_position).and_return(seq - 1)
      allow(r).to receive(:increment_table_position).and_return(seq)
      allow(r).to receive(:delete_table_source_pos).with(table)
      r
    end
    let(:table_meta) { double'table_meta' }
    let(:cur_src_pos_file) { "mysql-bin.000066" }
    let(:tag) { "some_tag" }
    let(:table_rev) { 1 }
    let(:flydata_record_version) { 2 }
    let(:context) do
      require 'flydata/source_mysql/plugin_support/context'
      Flydata::SourceMysql::PluginSupport::Context.new(
        sync_fm: sync_fm,
        database: target_database,
        tables: [table],
        table_meta: table_meta,
        cur_src_pos_file: cur_src_pos_file,
        omit_events: {},
        table_revs: {table => table_rev},
        tag: tag,
      )
    end
    let(:query) { "a_query" }
    let(:normalized_query) { 'a_query' }
    let(:event_length) { 20 }
    let(:next_position) { 200 }
    let(:timestamp) { 1427973738 }
    let(:record) do
      {
        'db_name' => database,
        'query' => query,
        'table_name' => table,
        'normalized_query' => normalized_query,
        'next_position' => next_position,
        'event_length' => event_length,
        'timestamp' => "#{timestamp}",
      }
    end
    subject { described_class.new(context) }
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
flydata-0.7.13 spec/flydata/source_mysql/plugin_support/shared_query_handler_context.rb
flydata-0.7.12 spec/flydata/source_mysql/plugin_support/shared_query_handler_context.rb
flydata-0.7.11 spec/flydata/source_mysql/plugin_support/shared_query_handler_context.rb
flydata-0.7.10 spec/flydata/source_mysql/plugin_support/shared_query_handler_context.rb
flydata-0.7.9 spec/flydata/source_mysql/plugin_support/shared_query_handler_context.rb
flydata-0.7.8 spec/flydata/source_mysql/plugin_support/shared_query_handler_context.rb
flydata-0.7.7 spec/flydata/source_mysql/plugin_support/shared_query_handler_context.rb
flydata-0.7.6 spec/flydata/source_mysql/plugin_support/shared_query_handler_context.rb
flydata-0.7.5 spec/flydata/source_mysql/plugin_support/shared_query_handler_context.rb
flydata-0.7.4 spec/flydata/source_mysql/plugin_support/shared_query_handler_context.rb
flydata-0.7.2.1 spec/flydata/source_mysql/plugin_support/shared_query_handler_context.rb
flydata-0.7.2 spec/flydata/source_mysql/plugin_support/shared_query_handler_context.rb
flydata-0.7.1 spec/flydata/source_mysql/plugin_support/shared_query_handler_context.rb
flydata-0.7.0 spec/flydata/source_mysql/plugin_support/shared_query_handler_context.rb