use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.
the class CsvBalanceFileReaderTest method readInvalidWhenFileHasInvalidVersion.
@Test
void readInvalidWhenFileHasInvalidVersion() throws IOException {
List<String> lines = FileUtils.readLines(balanceFile, CsvBalanceFileReader.CHARSET);
lines.remove(0);
List<String> copy = new LinkedList<>();
copy.add("# 0.1.0");
copy.addAll(lines);
FileUtils.writeLines(testFile, copy);
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 readInvalidWhenFileHasNoHeader.
@Test
void readInvalidWhenFileHasNoHeader() throws IOException {
List<String> lines = FileUtils.readLines(balanceFile, CsvBalanceFileReader.CHARSET);
lines.remove(0);
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 supportsInvalidWhenEmpty.
@Test
void supportsInvalidWhenEmpty() {
StreamFileData streamFileData = StreamFileData.from(balanceFile.getName(), "");
assertThat(balanceFileReader.supports(streamFileData)).isFalse();
}
use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.
the class CsvBalanceFileReaderTest method supports.
@Test
void supports() {
StreamFileData streamFileData = StreamFileData.from(balanceFile);
assertThat(balanceFileReader.supports(streamFileData)).isTrue();
}
use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.
the class ProtoBalanceFileReaderTest method missingTimestamp.
@Test
void missingTimestamp() {
AllAccountBalances allAccountBalances = AllAccountBalances.newBuilder().addAllAccounts(SingleAccountBalances.newBuilder().build()).build();
byte[] bytes = allAccountBalances.toByteArray();
StreamFileData streamFileData = StreamFileData.from(TIMESTAMP + "_Balances.pb", bytes);
assertThrows(InvalidStreamFileException.class, () -> protoBalanceFileReader.read(streamFileData));
}
Aggregations