use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.
the class BalanceFileReaderImplV1Test method readValidFileWithLeadingEmptyLine.
@Test
void readValidFileWithLeadingEmptyLine() throws IOException {
List<String> lines = FileUtils.readLines(balanceFile, CsvBalanceFileReader.CHARSET);
List<String> copy = new LinkedList<>();
copy.add("");
copy.addAll(lines);
FileUtils.writeLines(testFile, copy);
StreamFileData streamFileData = StreamFileData.from(testFile);
AccountBalanceFile accountBalanceFile = balanceFileReader.read(streamFileData);
assertAccountBalanceFile(accountBalanceFile);
verifySuccess(testFile, accountBalanceFile, 2);
}
use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.
the class BalanceFileReaderImplV1Test method supportsInvalidWhenWrongVersion.
@Test
void supportsInvalidWhenWrongVersion() {
StreamFileData streamFileData = StreamFileData.from(balanceFile.getName(), BalanceFileReaderImplV2.VERSION_HEADER);
assertThat(balanceFileReader.supports(streamFileData)).isFalse();
}
use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.
the class BalanceFileReaderImplV2Test method supportsInvalidWhenWrongVersion.
@Test
void supportsInvalidWhenWrongVersion() {
StreamFileData streamFileData = StreamFileData.from(balanceFile.getName(), BalanceFileReaderImplV1.TIMESTAMP_HEADER_PREFIX);
assertThat(balanceFileReader.supports(streamFileData)).isFalse();
}
use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.
the class CompositeBalanceFileReaderTest method defaultsToVersion1Reader.
@Test
void defaultsToVersion1Reader() {
StreamFileData streamFileData = StreamFileData.from(BALANCE_FILENAME_PREFIX + ".csv", "timestamp:1");
configMockReader(protoBalanceFileReader, streamFileData, false);
configMockReader(readerImplV1, streamFileData, true);
compositeBalanceFileReader.read(streamFileData);
verify(readerImplV1, times(1)).read(streamFileData);
verify(readerImplV2, never()).read(streamFileData);
verify(protoBalanceFileReader, never()).read(streamFileData);
}
use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.
the class CsvBalanceFileReaderTest method supportsInvalidWhenInvalidFirstLine.
@Test
void supportsInvalidWhenInvalidFirstLine() {
StreamFileData streamFileData = StreamFileData.from(balanceFile.getName(), "junk");
assertThat(balanceFileReader.supports(streamFileData)).isFalse();
}
Aggregations