Sha256: ea34eea31ea4698a6185b08631698843ce5d259b46d8e4d095c4e859dd1374fd

Contents?: true

Size: 1.89 KB

Versions: 4

Compression:

Stored size: 1.89 KB

Contents

require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")

describe HBase::Operation::TableOperation do
  before :all do
    url = ENV["HBASE_URL"].nil? ? "http://localhost:8080" : ENV["HBASE_URL"]
    @client = HBase::Client.new(url)
  end

  it "should create a table called test-hbase-ruby" do
    table = @client.create_table('test-hbase-ruby', { :name => 'habbit',
                                   :max_version => 3,
                                   :compression => HBase::Model::CompressionType::NONE,
                                   :in_memory => false,
                                   :block_cache => false,
                                   :ttl => -1,
                                   :max_cell_size => 2147483647,
                                   :bloomfilter => false
                                 })
    table.should.is_a? HBase::Model::TableDescriptor
  end

  it "should show the table info of 'test-hbase-ruby'" do
    table = @client.show_table('test-hbase-ruby')
    table.should.is_a? HBase::Model::TableDescriptor
    table.name.should == "test-hbase-ruby"
    table.column_families.should respond_to(:each)
    table.column_families.map(&:name).should include("habbit")
    table.column_families.each do |cf|
      cf.should.is_a? HBase::Model::ColumnDescriptor
    end
  end

  it "should disable table 'test-hbase-ruby'" do
    lambda {
      table = @client.disable_table('test-hbase-ruby')
    }.should_not raise_error
  end

  it "should enable table 'test-hbase-ruby'" do
    lambda {
      table = @client.enable_table('test-hbase-ruby')
    }.should_not raise_error
  end

  it "should delete the table 'test-hbase-ruby'" do
    lambda {
      table = @client.destroy_table("test-hbase-ruby")
    }.should_not raise_error

    lambda {
      table = @client.show_table("test-hbase-ruby")
    }.should raise_error(HBase::TableNotFoundError)
  end

  after :all do
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hbase-ruby-1.1.3 spec/hbase/operation/table_operation_spec.rb
hbase-ruby-1.1.2 spec/hbase/operation/table_operation_spec.rb
hbase-ruby-1.1.1 spec/hbase/operation/table_operation_spec.rb
hbase-ruby-1.1.0 spec/hbase/operation/table_operation_spec.rb