Search in sources :

Example 21 with AccountBalanceFile

use of com.hedera.mirror.common.domain.balance.AccountBalanceFile in project hedera-mirror-node by hashgraph.

the class AccountBalanceFileParserTest method duplicateFile.

@Test
void duplicateFile() {
    // given
    AccountBalanceFile accountBalanceFile = accountBalanceFile(1);
    AccountBalanceFile duplicate = accountBalanceFile(1);
    List<AccountBalance> items = accountBalanceFile.getItems().collectList().block();
    // when
    accountBalanceFileParser.parse(accountBalanceFile);
    // Will be ignored
    accountBalanceFileParser.parse(duplicate);
    // then
    assertThat(accountBalanceFileRepository.count()).isEqualTo(1L);
    assertAccountBalanceFile(accountBalanceFile, items);
}
Also used : AccountBalanceFile(com.hedera.mirror.common.domain.balance.AccountBalanceFile) AccountBalance(com.hedera.mirror.common.domain.balance.AccountBalance) Test(org.junit.jupiter.api.Test) IntegrationTest(com.hedera.mirror.importer.IntegrationTest)

Example 22 with AccountBalanceFile

use of com.hedera.mirror.common.domain.balance.AccountBalanceFile in project hedera-mirror-node by hashgraph.

the class AccountBalanceFileParserTest method beforeStartDate.

@Test
void beforeStartDate() {
    // given
    AccountBalanceFile accountBalanceFile = accountBalanceFile(-1L);
    // when
    accountBalanceFileParser.parse(accountBalanceFile);
    // then
    assertThat(accountBalanceFileRepository.findAll()).usingElementComparatorIgnoringFields("bytes", "items").containsExactly(accountBalanceFile);
    assertThat(accountBalanceRepository.count()).isZero();
    assertAccountBalanceFile(accountBalanceFile, List.of());
}
Also used : AccountBalanceFile(com.hedera.mirror.common.domain.balance.AccountBalanceFile) Test(org.junit.jupiter.api.Test) IntegrationTest(com.hedera.mirror.importer.IntegrationTest)

Example 23 with AccountBalanceFile

use of com.hedera.mirror.common.domain.balance.AccountBalanceFile in project hedera-mirror-node by hashgraph.

the class AccountBalanceFileParserTest method errata.

@Test
void errata() {
    // given
    var network = mirrorProperties.getNetwork();
    mirrorProperties.setNetwork(MirrorProperties.HederaNetwork.MAINNET);
    AccountBalanceFile accountBalanceFile = accountBalanceFile(BAD_TIMESTAMP1);
    List<AccountBalance> items = accountBalanceFile.getItems().collectList().block();
    // when
    accountBalanceFileParser.parse(accountBalanceFile);
    // then
    assertAccountBalanceFile(accountBalanceFile, items);
    assertThat(accountBalanceFile.getTimeOffset()).isEqualTo(-1);
    mirrorProperties.setNetwork(network);
}
Also used : AccountBalanceFile(com.hedera.mirror.common.domain.balance.AccountBalanceFile) AccountBalance(com.hedera.mirror.common.domain.balance.AccountBalance) Test(org.junit.jupiter.api.Test) IntegrationTest(com.hedera.mirror.importer.IntegrationTest)

Aggregations

AccountBalanceFile (com.hedera.mirror.common.domain.balance.AccountBalanceFile)23 Test (org.junit.jupiter.api.Test)18 IntegrationTest (com.hedera.mirror.importer.IntegrationTest)9 AccountBalance (com.hedera.mirror.common.domain.balance.AccountBalance)8 StreamFileData (com.hedera.mirror.importer.domain.StreamFileData)7 Instant (java.time.Instant)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 UnknownFieldSet (com.google.protobuf.UnknownFieldSet)2 TokenBalance (com.hedera.mirror.common.domain.balance.TokenBalance)2 EntityId (com.hedera.mirror.common.domain.entity.EntityId)2 AllAccountBalances (com.hedera.services.stream.proto.AllAccountBalances)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Stopwatch (com.google.common.base.Stopwatch)1 CodedInputStream (com.google.protobuf.CodedInputStream)1 StreamType (com.hedera.mirror.common.domain.StreamType)1 EntityType (com.hedera.mirror.common.domain.entity.EntityType)1 DomainUtils (com.hedera.mirror.common.util.DomainUtils)1