protected StoreFile createMockStoreFileBytes(final long size) {
return createMockStoreFile(size, -1L);
}
protected StoreFile createMockStoreFile(final long sizeInBytes, final long seqId) {
StoreFile mockSf = mock(StoreFile.class);
StoreFile.Reader reader = mock(StoreFile.Reader.class);
String stringPath = "/hbase/testTable/regionA/"
+ RandomStringUtils.random(FILENAME_LENGTH, 0, 0, true, true, null, random);
Path path = new Path(stringPath);
when(reader.getSequenceID()).thenReturn(seqId);
when(reader.getTotalUncompressedBytes()).thenReturn(sizeInBytes);
when(reader.length()).thenReturn(sizeInBytes);
when(mockSf.getPath()).thenReturn(path);
when(mockSf.excludeFromMinorCompaction()).thenReturn(false);
when(mockSf.isReference()).thenReturn(false); // TODO come back to
// this when selection takes this into account
when(mockSf.getReader()).thenReturn(reader);
String toString = Objects.toStringHelper("MockStoreFile")
.add("isReference", false)
.add("fileSize", StringUtils.humanReadableInt(sizeInBytes))
.add("seqId", seqId)
.add("path", stringPath).toString();
when(mockSf.toString()).thenReturn(toString);
return mockSf;
}