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));
}
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));
}
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);
}
Aggregations