use of org.hbase.async.KeyValue in project opentsdb by OpenTSDB.
the class TestRowSeq method timestampMixedNormalized.
@Test
public void timestampMixedNormalized() throws Exception {
final byte[] qual1 = { 0x00, 0x07 };
final byte[] val1 = Bytes.fromLong(4L);
final byte[] qual2 = { (byte) 0xF0, 0x00, 0x02, 0x07 };
final byte[] val2 = Bytes.fromLong(5L);
final byte[] qual12 = MockBase.concatByteArrays(qual1, qual2);
final KeyValue kv = makekv(KEY, qual12, MockBase.concatByteArrays(val1, val2, ZERO));
final RowSeq rs = new RowSeq(tsdb);
rs.setRow(kv);
assertEquals(1356998400000L, rs.timestamp(0));
assertEquals(1356998400008L, rs.timestamp(1));
}
use of org.hbase.async.KeyValue in project opentsdb by OpenTSDB.
the class TestRowSeq method iterateMs.
@Test
public void iterateMs() throws Exception {
final byte[] qual1 = { (byte) 0xF0, 0x00, 0x00, 0x07 };
final byte[] val1 = Bytes.fromLong(4L);
final byte[] qual2 = { (byte) 0xF0, 0x00, 0x02, 0x07 };
final byte[] val2 = Bytes.fromLong(5L);
final byte[] qual12 = MockBase.concatByteArrays(qual1, qual2);
final KeyValue kv = makekv(KEY, qual12, MockBase.concatByteArrays(val1, val2, ZERO));
final RowSeq rs = new RowSeq(tsdb);
rs.setRow(kv);
final SeekableView it = rs.iterator();
DataPoint dp = it.next();
assertEquals(1356998400000L, dp.timestamp());
assertEquals(4, dp.longValue());
dp = it.next();
assertEquals(1356998400008L, dp.timestamp());
assertEquals(5, dp.longValue());
assertFalse(it.hasNext());
}
use of org.hbase.async.KeyValue in project opentsdb by OpenTSDB.
the class TestRowSeq method setRowAlreadySet.
@Test(expected = IllegalStateException.class)
public void setRowAlreadySet() throws Exception {
final byte[] qual1 = { 0x00, 0x07 };
final byte[] val1 = Bytes.fromLong(4L);
final byte[] qual2 = { 0x00, 0x27 };
final byte[] val2 = Bytes.fromLong(5L);
final byte[] qual12 = MockBase.concatByteArrays(qual1, qual2);
final KeyValue kv = makekv(KEY, qual12, MockBase.concatByteArrays(val1, val2, ZERO));
final RowSeq rs = new RowSeq(tsdb);
rs.setRow(kv);
assertEquals(2, rs.size());
rs.setRow(kv);
}
use of org.hbase.async.KeyValue in project opentsdb by OpenTSDB.
the class TestRowSeq method timestamp.
@Test
public void timestamp() throws Exception {
final byte[] qual1 = { 0x00, 0x07 };
final byte[] val1 = Bytes.fromLong(4L);
final byte[] qual2 = { 0x00, 0x27 };
final byte[] val2 = Bytes.fromLong(5L);
final byte[] qual12 = MockBase.concatByteArrays(qual1, qual2);
final KeyValue kv = makekv(KEY, qual12, MockBase.concatByteArrays(val1, val2, ZERO));
final RowSeq rs = new RowSeq(tsdb);
rs.setRow(kv);
assertEquals(1356998400000L, rs.timestamp(0));
assertEquals(1356998402000L, rs.timestamp(1));
}
use of org.hbase.async.KeyValue in project opentsdb by OpenTSDB.
the class TestRowSeq method timestampNormalizeMS.
@Test
public void timestampNormalizeMS() throws Exception {
final byte[] qual1 = { 0x00, 0x07 };
final byte[] val1 = Bytes.fromLong(4L);
final byte[] qual2 = { 0x00, 0x27 };
final byte[] val2 = Bytes.fromLong(5L);
final byte[] qual12 = MockBase.concatByteArrays(qual1, qual2);
final KeyValue kv = makekv(KEY, qual12, MockBase.concatByteArrays(val1, val2, ZERO));
final RowSeq rs = new RowSeq(tsdb);
rs.setRow(kv);
assertEquals(1356998400000L, rs.timestamp(0));
assertEquals(1356998402000L, rs.timestamp(1));
}
Aggregations