use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.
the class CsvBalanceFileReaderTest method supportsInvalidWhenEmptyFirstLine.
@Test
void supportsInvalidWhenEmptyFirstLine() {
String versionPrefix = balanceFileReader.getVersionHeaderPrefix();
StreamFileData streamFileData = StreamFileData.from(balanceFile.getName(), '\n' + versionPrefix);
assertThat(balanceFileReader.supports(streamFileData)).isFalse();
}
use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.
the class CsvBalanceFileReaderTest method readInvalidWhenFileHasNoTimestampHeader.
@Test
void readInvalidWhenFileHasNoTimestampHeader() throws IOException {
List<String> lines = FileUtils.readLines(balanceFile, CsvBalanceFileReader.CHARSET);
lines.remove(0);
FileUtils.writeLines(testFile, lines);
StreamFileData streamFileData = StreamFileData.from(testFile);
assertThrows(InvalidDatasetException.class, () -> balanceFileReader.read(streamFileData));
}
use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.
the class CsvBalanceFileReaderTest method readInvalidWhenFileIsEmpty.
@Test
void readInvalidWhenFileIsEmpty() {
StreamFileData streamFileData = StreamFileData.from(balanceFile.getName(), "");
assertThrows(InvalidDatasetException.class, () -> balanceFileReader.read(streamFileData));
}
use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.
the class CsvBalanceFileReaderTest method readValidWhenFileHasBadTrailingLines.
@Test
void readValidWhenFileHasBadTrailingLines() throws IOException {
List<String> lines = FileUtils.readLines(balanceFile, CsvBalanceFileReader.CHARSET);
FileUtils.writeLines(testFile, lines);
FileUtils.writeStringToFile(testFile, "\n0.0.3.20340\nfoobar\n", CsvBalanceFileReader.CHARSET, true);
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 CsvBalanceFileReaderTest method readValid.
@Test
void readValid() throws Exception {
StreamFileData streamFileData = StreamFileData.from(balanceFile);
AccountBalanceFile accountBalanceFile = balanceFileReader.read(streamFileData);
assertAccountBalanceFile(accountBalanceFile);
assertFileHash(balanceFile, accountBalanceFile);
verifySuccess(balanceFile, accountBalanceFile, 2);
}
Aggregations