()
| 613 | } |
| 614 | |
| 615 | @Test |
| 616 | public void fixQualifierFlags() throws Exception { |
| 617 | ArrayList<KeyValue> kvs = new ArrayList<KeyValue>(2); |
| 618 | ArrayList<Annotation> annotations = new ArrayList<Annotation>(0); |
| 619 | // Note: here the flags pretend the value is on 4 bytes, but it's actually |
| 620 | // on 8 bytes, so we expect the code to fix the flags as it's compacting. |
| 621 | final byte[] qual1 = { 0x00, 0x03 }; // Pretends 4 bytes... |
| 622 | final byte[] val1 = Bytes.fromLong(4L); // ... 8 bytes actually. |
| 623 | final byte[] cqual1 = { 0x00, 0x07 }; // Should have been this. |
| 624 | kvs.add(makekv(qual1, val1)); |
| 625 | final byte[] qual2 = { 0x00, 0x17 }; |
| 626 | final byte[] val2 = Bytes.fromLong(5L); |
| 627 | kvs.add(makekv(qual2, val2)); |
| 628 | |
| 629 | final KeyValue kv = compactionq.compact(kvs, annotations, null); |
| 630 | assertArrayEquals(MockBase.concatByteArrays(cqual1, qual2), kv.qualifier()); |
| 631 | assertArrayEquals(MockBase.concatByteArrays(val1, val2, ZERO), kv.value()); |
| 632 | |
| 633 | // We had one row to compact, so one put to do. |
| 634 | verify(tsdb, times(1)).put(KEY, MockBase.concatByteArrays(cqual1, qual2), |
| 635 | MockBase.concatByteArrays(val1, val2, ZERO), kvCount - 1); |
| 636 | // And we had to delete individual cells. |
| 637 | verify(tsdb, times(1)).delete(eq(KEY), eqAnyOrder(new byte[][] { qual1, qual2 })); |
| 638 | } |
| 639 | |
| 640 | @Test |
| 641 | public void fixFloatingPoint() throws Exception { |
nothing calls this directly
no test coverage detected