use of org.hbase.async.KeyValue in project opentsdb by OpenTSDB.
the class TestRowSeq method addRowDiffBaseTime.
@Test(expected = IllegalDataException.class)
public void addRowDiffBaseTime() 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 RowSeq rs = new RowSeq(tsdb);
rs.setRow(makekv(KEY, qual12, MockBase.concatByteArrays(val1, val2, ZERO)));
assertEquals(2, rs.size());
final byte[] qual3 = { 0x00, 0x37 };
final byte[] val3 = Bytes.fromLong(6L);
final byte[] qual4 = { 0x00, 0x47 };
final byte[] val4 = Bytes.fromLong(7L);
final byte[] qual34 = MockBase.concatByteArrays(qual3, qual4);
final byte[] row2 = { 0, 0, 1, 0x50, (byte) 0xE2, 0x35, 0x10, 0, 0, 1, 0, 0, 2 };
rs.addRow(new KeyValue(row2, FAMILY, qual34, MockBase.concatByteArrays(val3, val4, ZERO)));
}
use of org.hbase.async.KeyValue in project opentsdb by OpenTSDB.
the class TestRowSeq method addRowDiffBaseTimeSalt.
@Test(expected = IllegalDataException.class)
public void addRowDiffBaseTimeSalt() throws Exception {
setupSalt();
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 RowSeq rs = new RowSeq(tsdb);
rs.setRow(makekv(SALTED_KEY, qual12, MockBase.concatByteArrays(val1, val2, ZERO)));
assertEquals(2, rs.size());
final byte[] qual3 = { 0x00, 0x37 };
final byte[] val3 = Bytes.fromLong(6L);
final byte[] qual4 = { 0x00, 0x47 };
final byte[] val4 = Bytes.fromLong(7L);
final byte[] qual34 = MockBase.concatByteArrays(qual3, qual4);
final byte[] row2 = { 1, 0, 0, 1, 0x50, (byte) 0xE2, 0x35, 0x10, 0, 0, 1, 0, 0, 2 };
rs.addRow(new KeyValue(row2, FAMILY, qual34, MockBase.concatByteArrays(val3, val4, ZERO)));
}
use of org.hbase.async.KeyValue in project opentsdb by OpenTSDB.
the class TestRowSeq method timestampSalted.
@Test
public void timestampSalted() throws Exception {
setupSalt();
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(SALTED_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 timestampOutofBounds.
@Test(expected = IndexOutOfBoundsException.class)
public void timestampOutofBounds() 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);
assertEquals(1356998400000L, rs.timestamp(0));
assertEquals(1356998400008L, rs.timestamp(1));
rs.timestamp(2);
}
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));
}
Aggregations