Search in sources :

Example 1 with AllAccountBalances

use of com.hedera.services.stream.proto.AllAccountBalances 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));
}
Also used : AllAccountBalances(com.hedera.services.stream.proto.AllAccountBalances) StreamFileData(com.hedera.mirror.importer.domain.StreamFileData) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with AllAccountBalances

use of com.hedera.services.stream.proto.AllAccountBalances in project hedera-mirror-node by hashgraph.

the class ProtoBalanceFileReaderTest method emptyProtobuf.

@Test
void emptyProtobuf() {
    AllAccountBalances allAccountBalances = AllAccountBalances.newBuilder().build();
    byte[] bytes = allAccountBalances.toByteArray();
    StreamFileData streamFileData = StreamFileData.from(TIMESTAMP + "_Balances.pb", bytes);
    assertThrows(InvalidStreamFileException.class, () -> protoBalanceFileReader.read(streamFileData));
}
Also used : AllAccountBalances(com.hedera.services.stream.proto.AllAccountBalances) StreamFileData(com.hedera.mirror.importer.domain.StreamFileData) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with AllAccountBalances

use of com.hedera.services.stream.proto.AllAccountBalances in project hedera-mirror-node by hashgraph.

the class ProtoBalanceFileReaderTest method unknownFields.

@Test
void unknownFields() {
    UnknownFieldSet.Field field = UnknownFieldSet.Field.newBuilder().addFixed32(11).build();
    AllAccountBalances allAccountBalances = AllAccountBalances.newBuilder().setConsensusTimestamp(Timestamp.newBuilder().setSeconds(1L).build()).mergeUnknownFields(UnknownFieldSet.newBuilder().addField(23, field).build()).addAllAccounts(SingleAccountBalances.newBuilder().build()).build();
    byte[] bytes = allAccountBalances.toByteArray();
    StreamFileData streamFileData = StreamFileData.from(TIMESTAMP + "_Balances.pb", bytes);
    AccountBalanceFile accountBalanceFile = protoBalanceFileReader.read(streamFileData);
    assertThat(accountBalanceFile).isNotNull();
    assertThat(accountBalanceFile.getItems().count().block()).isEqualTo(1L);
}
Also used : AllAccountBalances(com.hedera.services.stream.proto.AllAccountBalances) AccountBalanceFile(com.hedera.mirror.common.domain.balance.AccountBalanceFile) StreamFileData(com.hedera.mirror.importer.domain.StreamFileData) UnknownFieldSet(com.google.protobuf.UnknownFieldSet) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

StreamFileData (com.hedera.mirror.importer.domain.StreamFileData)3 AllAccountBalances (com.hedera.services.stream.proto.AllAccountBalances)3 Test (org.junit.jupiter.api.Test)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 UnknownFieldSet (com.google.protobuf.UnknownFieldSet)1 AccountBalanceFile (com.hedera.mirror.common.domain.balance.AccountBalanceFile)1