Package org.hbase.async

Examples of org.hbase.async.KeyValue


    final UniqueId uid_b = new UniqueId(client_b, table, kind, 3);

    final byte[] id = { 0, 0, 5 };
    final byte[] byte_name = { 'f', 'o', 'o' };
    final ArrayList<KeyValue> kvs = new ArrayList<KeyValue>(1);
    kvs.add(new KeyValue(byte_name, ID, kind_array, id));

    @SuppressWarnings("unchecked")
    final Deferred<ArrayList<KeyValue>> d = PowerMockito.spy(new Deferred<ArrayList<KeyValue>>());
    when(client.get(anyGet()))
      .thenReturn(d)
View Full Code Here


    final ArrayList<ArrayList<KeyValue>> rows = new ArrayList<ArrayList<KeyValue>>(2);
    final byte[] foo_bar_id = { 0, 0, 1 };
    {
      ArrayList<KeyValue> row = new ArrayList<KeyValue>(1);
      row.add(new KeyValue("foo.bar".getBytes(), ID, kind_array, foo_bar_id));
      rows.add(row);
      row = new ArrayList<KeyValue>(1);
      row.add(new KeyValue("foo.baz".getBytes(), ID, kind_array,
                           new byte[] { 0, 0, 2 }));
      rows.add(row);
    }
    when(fake_scanner.nextRows())
      .thenReturn(Deferred.<ArrayList<ArrayList<KeyValue>>>fromResult(rows))
View Full Code Here

  // Helper functions. //
  // ----------------- //

  /** Shorthand to create a {@link KeyValue}.  */
  private static KeyValue makekv(final byte[] qualifier, final byte[] value) {
    return new KeyValue(KEY, FAMILY, qualifier, value);
  }
View Full Code Here

  public void getUsedUIDs() throws Exception {
    final ArrayList<KeyValue> kvs = new ArrayList<KeyValue>(3);
    final byte[] metrics = { 'm', 'e', 't', 'r', 'i', 'c', 's' };
    final byte[] tagk = { 't', 'a', 'g', 'k' };
    final byte[] tagv = { 't', 'a', 'g', 'v' };
    kvs.add(new KeyValue(MAXID, ID, metrics, Bytes.fromLong(64L)));
    kvs.add(new KeyValue(MAXID, ID, tagk, Bytes.fromLong(42L)));
    kvs.add(new KeyValue(MAXID, ID, tagv, Bytes.fromLong(1024L)));
    final TSDB tsdb = mock(TSDB.class);
    when(tsdb.getClient()).thenReturn(client);
    when(tsdb.uidTable()).thenReturn(new byte[] { 'u', 'i', 'd' });
    when(client.get(anyGet()))
      .thenReturn(Deferred.fromResult(kvs));
View Full Code Here

    final byte[] qual2 = { 0x00, 0x27 };
    final byte[] val2 = Bytes.fromLong(5L);
    final byte[] qual12 = MockBase.concatByteArrays(qual1, qual2);
   
    final Span span = new Span(tsdb);
    span.addRow(new KeyValue(HOUR1, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO)));
   
    assertEquals(2, span.size());
  }
View Full Code Here

    final byte[] qual2 = { 0x00, 0x27 };
    final byte[] val2 = Bytes.fromLong(5L);
    final byte[] qual12 = MockBase.concatByteArrays(qual1, qual2);
   
    final Span span = new Span(tsdb);
    span.addRow(new KeyValue(HOUR1, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO)));
   
    final byte[] bad_key =
      new byte[] { 0, 0, 1, 0x50, (byte)0xE2, 0x43, 0x20, 0, 0, 1 };
    span.addRow(new KeyValue(bad_key, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO)));
  }
View Full Code Here

    final byte[] qual2 = { 0x00, 0x27 };
    final byte[] val2 = Bytes.fromLong(5L);
    final byte[] qual12 = MockBase.concatByteArrays(qual1, qual2);
   
    final Span span = new Span(tsdb);
    span.addRow(new KeyValue(HOUR1, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO)));
   
    final byte[] bad_key =
      new byte[] { 0, 0, 2, 0x50, (byte)0xE2, 0x35, 0x10, 0, 0, 1, 0, 0, 2 };
    span.addRow(new KeyValue(bad_key, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO)));
  }
View Full Code Here

    final byte[] qual2 = { 0x00, 0x27 };
    final byte[] val2 = Bytes.fromLong(5L);
    final byte[] qual12 = MockBase.concatByteArrays(qual1, qual2);
   
    final Span span = new Span(tsdb);
    span.addRow(new KeyValue(HOUR1, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO)));
   
    final byte[] bad_key =
      new byte[] { 0, 0, 1, 0x50, (byte)0xE2, 0x35, 0x10, 0, 0, 2, 0, 0, 2 };
    span.addRow(new KeyValue(bad_key, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO)));
  }
View Full Code Here

    final byte[] qual2 = { 0x00, 0x27 };
    final byte[] val2 = Bytes.fromLong(5L);
    final byte[] qual12 = MockBase.concatByteArrays(qual1, qual2);
   
    final Span span = new Span(tsdb);
    span.addRow(new KeyValue(HOUR1, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO)));
   
    final byte[] bad_key =
      new byte[] { 0, 0, 1, 0x50, (byte)0xE2, 0x35, 0x10, 0, 0, 1, 0, 0, 3 };
    span.addRow(new KeyValue(bad_key, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO)));
  }
View Full Code Here

    final byte[] qual2 = { 0x00, 0x27 };
    final byte[] val2 = Bytes.fromLong(5L);
    final byte[] qual12 = MockBase.concatByteArrays(qual1, qual2);
   
    final Span span = new Span(tsdb);
    span.addRow(new KeyValue(HOUR2, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO)));
    span.addRow(new KeyValue(HOUR1, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO)));
    assertEquals(4, span.size());
   
    assertEquals(1356998400000L, span.timestamp(0));
    assertEquals(4, span.longValue(0));
View Full Code Here

TOP

Related Classes of org.hbase.async.KeyValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.