Sha256: e743a81d3f4f630bf02a40745d2b786f3dbaef74e32b8c8d75e10e98fe2ec0ce

Contents?: true

Size: 1.34 KB

Versions: 6

Compression:

Stored size: 1.34 KB

Contents

$VERBOSE = true

require 'rubygems'
require "test-unit"
require 'simplecov'
SimpleCov.start

RECREATE = false

unless defined? Enumerator
  Enumerator = Enumerable::Enumerator
end

$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)

require "hbase-jruby"
if dist = ENV['HBASE_JRUBY_TEST_DIST']
  HBase.resolve_dependency!(dist, :verbose => true)
end
HBase.log4j = { 'log4j.threshold' => 'ERROR' }

class TestHBaseJRubyBase < Test::Unit::TestCase
  TABLE = 'test_hbase_jruby'
  ZK    = ENV.fetch 'HBASE_JRUBY_TEST_ZK'

  # Initialize
  hbase = HBase.new 'hbase.zookeeper.quorum' => ZK
  hbase.table(TABLE) do |table|
    table.drop! if table.exists?
  end
  hbase.close

  def connect
    HBase.new 'hbase.zookeeper.quorum' => ZK
  end

  def setup
    @hbase = connect
    @table = @hbase.table(TABLE)

    # Drop & Create
    @table.drop! if RECREATE && @table.exists?
    @table.create!(
      :cf1 => { :compression => :none, :bloomfilter => :row },
      :cf2 => { :bloomfilter => :rowcol },
      :cf3 => { :versions => 1, :bloomfilter => :rowcol }
    ) unless @table.exists?
    @table.enable! if @table.disabled?

    unless RECREATE
      @table.delete(*@table.map { |row| [row.rowkey(:raw)] })
      assert_equal 0, @table.count
    end
  end

  def teardown
    if RECREATE
      @table.drop! if @table && @table.exists?
    end
    @hbase.close
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hbase-jruby-0.3.5-java test/helper.rb
hbase-jruby-0.3.4-java test/helper.rb
hbase-jruby-0.3.3-java test/helper.rb
hbase-jruby-0.3.2-java test/helper.rb
hbase-jruby-0.3.1-java test/helper.rb
hbase-jruby-0.3.0-java test/helper.rb