use of com.hedera.mirror.common.domain.file.FileData in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerFileTest method assertFileData.
private void assertFileData(ByteString expected, Timestamp consensusTimestamp) {
FileData actualFileData = fileDataRepository.findById(DomainUtils.timeStampInNanos(consensusTimestamp)).get();
assertArrayEquals(expected.toByteArray(), actualFileData.getFileData());
}
use of com.hedera.mirror.common.domain.file.FileData in project hedera-mirror-node by hashgraph.
the class PubSubRecordItemListenerTest method testNetworkAddressBookAppend.
@Test
void testNetworkAddressBookAppend() throws Exception {
// given
byte[] fileContents = new byte[] { 0b0, 0b1, 0b10 };
Transaction transaction = buildTransaction(builder -> {
builder.setFileAppend(FileAppendTransactionBody.newBuilder().setFileID(ADDRESS_BOOK_FILE_ID).setContents(ByteString.copyFrom(fileContents)).build());
});
// when
EntityId entityId = EntityId.of(ADDRESS_BOOK_FILE_ID);
doReturn(entityId).when(transactionHandler).getEntity(any());
pubSubRecordItemListener.onItem(new RecordItem(transaction, DEFAULT_RECORD));
// then
FileData fileData = new FileData(100L, fileContents, entityId, TransactionType.FILEAPPEND.getProtoId());
verify(addressBookService).update(fileData);
}
Aggregations