use of com.hedera.mirror.common.domain.balance.AccountBalanceFile in project hedera-mirror-node by hashgraph.
the class ErrataMigrationTest method onEndWithoutOffset.
@Test
void onEndWithoutOffset() {
AccountBalanceFile accountBalanceFile = new AccountBalanceFile();
accountBalanceFile.setConsensusTimestamp(1L);
errataMigration.onEnd(accountBalanceFile);
assertThat(accountBalanceFile.getTimeOffset()).isZero();
}
use of com.hedera.mirror.common.domain.balance.AccountBalanceFile in project hedera-mirror-node by hashgraph.
the class ErrataMigrationTest method onEndNotMainnet.
@Test
void onEndNotMainnet() {
mirrorProperties.setNetwork(MirrorProperties.HederaNetwork.TESTNET);
AccountBalanceFile accountBalanceFile = new AccountBalanceFile();
accountBalanceFile.setConsensusTimestamp(BAD_TIMESTAMP1);
// Call to increase test coverage of no-op methods
errataMigration.onStart();
errataMigration.onError();
errataMigration.onEnd(accountBalanceFile);
assertThat(accountBalanceFile.getTimeOffset()).isZero();
}
use of com.hedera.mirror.common.domain.balance.AccountBalanceFile in project hedera-mirror-node by hashgraph.
the class ErrataMigrationTest method onEndWithOffset.
@Test
void onEndWithOffset() {
AccountBalanceFile accountBalanceFile = new AccountBalanceFile();
accountBalanceFile.setConsensusTimestamp(BAD_TIMESTAMP1);
// Call to increase test coverage of no-op methods
errataMigration.onStart();
errataMigration.onError();
errataMigration.onEnd(accountBalanceFile);
assertThat(accountBalanceFile.getTimeOffset()).isEqualTo(-1);
}
use of com.hedera.mirror.common.domain.balance.AccountBalanceFile in project hedera-mirror-node by hashgraph.
the class CsvBalanceFileReaderTest method readValidWhenFileHasLinesWithDifferentShardNum.
@Test
void readValidWhenFileHasLinesWithDifferentShardNum() throws IOException {
List<String> lines = FileUtils.readLines(balanceFile, CsvBalanceFileReader.CHARSET);
FileUtils.writeLines(testFile, lines);
long otherShard = mirrorProperties.getShard() + 1;
FileUtils.writeStringToFile(testFile, String.format("\n%d,0,3,340\n%d,0,4,340\n", otherShard, otherShard), CsvBalanceFileReader.CHARSET, true);
StreamFileData streamFileData = StreamFileData.from(testFile);
AccountBalanceFile accountBalanceFile = balanceFileReader.read(streamFileData);
assertAccountBalanceFile(accountBalanceFile);
verifySuccess(testFile, accountBalanceFile, 2);
}
use of com.hedera.mirror.common.domain.balance.AccountBalanceFile in project hedera-mirror-node by hashgraph.
the class CsvBalanceFileReaderTest method readValidWhenFileHasTrailingEmptyLines.
@Test
void readValidWhenFileHasTrailingEmptyLines() throws IOException {
List<String> lines = FileUtils.readLines(balanceFile, CsvBalanceFileReader.CHARSET);
FileUtils.writeLines(testFile, lines);
FileUtils.writeStringToFile(testFile, "\n\n\n", CsvBalanceFileReader.CHARSET, true);
StreamFileData streamFileData = StreamFileData.from(testFile);
AccountBalanceFile accountBalanceFile = balanceFileReader.read(streamFileData);
assertAccountBalanceFile(accountBalanceFile);
verifySuccess(testFile, accountBalanceFile, 2);
}
Aggregations