use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.
the class EventFileReaderV3Test method readInvalidFileWithInvalidPrevHashMarker.
@Test
void readInvalidFileWithInvalidPrevHashMarker() {
StreamFileData invalidFile = createEventFile(EventFileReaderV3.EVENT_STREAM_FILE_VERSION_3, (byte) 0x0, PREVIOUS_HASH, CONTENT);
assertThrows(InvalidEventFileException.class, () -> eventFileReader.read(invalidFile));
}
use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.
the class EventFileReaderV3Test method readInvalidFileWithInvalidVersion4.
@Test
void readInvalidFileWithInvalidVersion4() {
StreamFileData invalidFile = createEventFile(4, EventFileReaderV3.EVENT_TYPE_PREV_HASH, PREVIOUS_HASH, CONTENT);
assertThrows(InvalidEventFileException.class, () -> eventFileReader.read(invalidFile));
}
use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.
the class EventFileReaderV3Test method readInvalidFileWithInvalidVersion1.
@Test
void readInvalidFileWithInvalidVersion1() {
StreamFileData invalidFile = createEventFile(1, EventFileReaderV3.EVENT_TYPE_PREV_HASH, PREVIOUS_HASH, CONTENT);
assertThrows(InvalidEventFileException.class, () -> eventFileReader.read(invalidFile));
}
use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.
the class AbstractRecordFileReaderTest method readIncompatibleFile.
@TestFactory
Stream<DynamicTest> readIncompatibleFile() {
String template = "read incompatible version %d file %s";
return DynamicTest.stream(getFilteredFiles(true), (recordFile) -> String.format(template, recordFile.getVersion(), recordFile.getName()), (recordFile) -> {
// given
Path testFile = getTestFile(recordFile);
StreamFileData streamFileData = StreamFileData.from(testFile.toFile());
// when
assertThrows(InvalidStreamFileException.class, () -> recordFileReader.read(streamFileData));
});
}
use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.
the class RecordFileReaderImplV5Test method verifyRecordItemLinksInEthTransactionValidFile.
@SneakyThrows
@TestFactory
Stream<DynamicTest> verifyRecordItemLinksInEthTransactionValidFile() {
String template = "read file %s containing eth transactions";
var resourceResolver = new PathMatchingResourcePatternResolver();
return DynamicTest.stream(Arrays.stream(resourceResolver.getResources("classpath:data/recordstreams/eth-0.26.0/record0.0.3/*" + ".rcd")), (recordFile) -> String.format(template, recordFile.getFilename()), (recordFile) -> {
// given
StreamFileData streamFileData = StreamFileData.from(recordFile.getFile());
// when
RecordFile actual = recordFileReader.read(streamFileData);
// then
RecordItem previousItem = null;
RecordItem lastParentItem = null;
for (var item : actual.getItems().collectList().block()) {
// assert previous link points to previous item
assertThat(item.getPrevious()).isEqualTo(previousItem);
// confirm if child that parent is populated
if (item.isChild()) {
assertThat(item.getParent()).isEqualTo(lastParentItem);
} else {
lastParentItem = item;
}
previousItem = item;
}
});
}
Aggregations