Sha256: 181670ddd97edd91589560350ec9e1e48967d92baabe1c9b3db4b385f0b34ff0
Contents?: true
Size: 1.87 KB
Versions: 1
Compression:
Stored size: 1.87 KB
Contents
#!/usr/bin/env ruby $LOAD_PATH.unshift File.expand_path('..', __FILE__) require 'helper' require 'bigdecimal' class TestCell < Test::Unit::TestCase import org.apache.hadoop.hbase.KeyValue Util = HBase::Util def test_cell ts = Time.now.to_i * 1000 { 'value' => :string, :value => :symbol, 123 => :fixnum, 123456789012345678901234567890 => :bignum, 123.456 => :float, true => :boolean, false => :boolean, BigDecimal.new("123.456") => :bigdecimal }.each do |value, type| kv = KeyValue.new("rowkey".to_java_bytes, "hello".to_java_bytes, "world".to_java_bytes, ts, Util.to_bytes(value)) cell = HBase::Cell.new(kv) assert_equal "rowkey", cell.rowkey assert_equal "hello", cell.cf, cell.family assert_equal "world", cell.cq, cell.qualifier assert_equal ts, cell.ts assert_equal value, cell.send(type) assert_equal HBase::ColumnKey.new(:hello, :world), cell.column_key assert_instance_of String, cell.inspect end end def test_order ts = Time.now.to_i * 1000 val = "val".to_java_bytes cells = [ KeyValue.new("rowkey".to_java_bytes, "apple".to_java_bytes, "alpha".to_java_bytes, ts, val), KeyValue.new("rowkey".to_java_bytes, "apple".to_java_bytes, "alpha".to_java_bytes, ts - 1000, val), KeyValue.new("rowkey".to_java_bytes, "apple".to_java_bytes, "beta".to_java_bytes, ts, val), KeyValue.new("rowkey".to_java_bytes, "banana".to_java_bytes, "beta".to_java_bytes, ts, val), KeyValue.new("rowkey".to_java_bytes, "banana".to_java_bytes, "gamma".to_java_bytes, ts, val), ].map { |kv| HBase::Cell.new kv } assert_equal cells, cells.reverse.sort end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hbase-jruby-0.1.1-java | test/test_cell.rb |