use of org.neo4j.kernel.impl.store.MetaDataStore.Position.STORE_VERSION in project neo4j by neo4j.
the class MetaDataStoreTest method mustSupportScanningAllRecordsWithRecordCursor.
@Test
void mustSupportScanningAllRecordsWithRecordCursor() {
MetaDataStore.Position[] positions = MetaDataStore.Position.values();
long storeVersion = versionStringToLong(Standard.LATEST_RECORD_FORMATS.storeVersion());
try (MetaDataStore store = newMetaDataStore()) {
writeCorrectMetaDataRecord(store, positions, storeVersion);
}
List<Long> actualValues = new ArrayList<>();
try (MetaDataStore store = newMetaDataStore()) {
MetaDataRecord record = store.newRecord();
try (PageCursor cursor = store.openPageCursorForReading(0, NULL)) {
long highId = store.getHighId();
for (long id = 0; id < highId; id++) {
store.getRecordByCursor(id, record, RecordLoad.NORMAL, cursor);
if (record.inUse()) {
actualValues.add(record.getValue());
}
}
}
}
List<Long> expectedValues = Arrays.stream(positions).map(p -> {
if (p == STORE_VERSION) {
return storeVersion;
} else {
return p.ordinal() + 1L;
}
}).collect(Collectors.toList());
assertThat(actualValues).isEqualTo(expectedValues);
}
Aggregations