use of com.baidu.hugegraph.computer.core.store.file.hgkvfile.reader.HgkvFileReaderImpl in project hugegraph-computer by hugegraph.
the class HgkvFileTest method testHgkvFileReader.
@Test
public void testHgkvFileReader() throws Exception {
// The keys in the data must be ordered
List<Integer> data = testData();
String filePath = StoreTestUtil.availablePathById("1");
File file = StoreTestUtil.mapToHgkvFile(CONFIG, data, filePath);
KvEntryFileReader reader = new HgkvFileReaderImpl(file.getPath(), false);
try (EntryIterator iterator = reader.iterator()) {
int index = 0;
while (iterator.hasNext()) {
KvEntry next = iterator.next();
int key = StoreTestUtil.byteArrayToInt(next.key().bytes());
Assert.assertEquals(data.get(index).intValue(), key);
index += 2;
}
Assert.assertThrows(NoSuchElementException.class, iterator::next);
}
}
Aggregations