()
| 145 | } |
| 146 | |
| 147 | @Test |
| 148 | public void rowKeyFromTSUIDSalted() throws Exception { |
| 149 | PowerMockito.mockStatic(Const.class); |
| 150 | PowerMockito.when(Const.SALT_WIDTH()).thenReturn(1); |
| 151 | PowerMockito.when(Const.SALT_BUCKETS()).thenReturn(2); |
| 152 | |
| 153 | final byte[] tsuid = { 0, 0, 1, 0, 0, 1, 0, 0, 2 }; |
| 154 | byte[] key = { 1, 0, 0, 1, 0x50, (byte) 0xE2, 0x27, 0, 0, 0, 1, 0, 0, 2 }; |
| 155 | assertArrayEquals(key, RowKey.rowKeyFromTSUID(tsdb, tsuid, 1356998400)); |
| 156 | |
| 157 | // zero timestamp |
| 158 | key = new byte[] { 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2 }; |
| 159 | assertArrayEquals(key, RowKey.rowKeyFromTSUID(tsdb, tsuid, 0)); |
| 160 | |
| 161 | // negative timestamp; honey badger don't care |
| 162 | key = new byte[] { 1, 0, 0, 1, -1, -21, 88, -128, 0, 0, 1, 0, 0, 2 }; |
| 163 | assertArrayEquals(key, RowKey.rowKeyFromTSUID(tsdb, tsuid, -1356998400)); |
| 164 | |
| 165 | PowerMockito.when(Const.SALT_WIDTH()).thenReturn(4); |
| 166 | key = new byte[] { 0, 0, 0, 1, 0, 0, 1, 0x50, (byte) 0xE2, 0x27, 0, |
| 167 | 0, 0, 1, 0, 0, 2 }; |
| 168 | assertArrayEquals(key, RowKey.rowKeyFromTSUID(tsdb, tsuid, 1356998400)); |
| 169 | } |
| 170 | |
| 171 | |
| 172 | @Test |
nothing calls this directly
no test coverage detected