use of com.hedera.mirror.common.domain.entity.EntityId in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerTokenTest method assertNftInRepository.
private void assertNftInRepository(TokenID tokenID, long serialNumber, boolean present, long createdTimestamp, long modifiedTimestamp, AccountID accountId, boolean deleted) {
EntityId accountEntityId = accountId.equals(DEFAULT_ACCOUNT_ID) ? null : EntityId.of(accountId);
assertNftInRepository(tokenID, serialNumber, present, createdTimestamp, modifiedTimestamp, METADATA.getBytes(), accountEntityId, deleted);
}
use of com.hedera.mirror.common.domain.entity.EntityId in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerTokenTest method tokenDissociate.
@Test
void tokenDissociate() {
createAndAssociateToken(TOKEN_ID, FUNGIBLE_COMMON, SYMBOL, CREATE_TIMESTAMP, ASSOCIATE_TIMESTAMP, PAYER2, false, false, false, INITIAL_SUPPLY);
Transaction dissociateTransaction = tokenDissociate(List.of(TOKEN_ID), PAYER2);
long dissociateTimeStamp = 10L;
insertAndParseTransaction(dissociateTimeStamp, dissociateTransaction);
EntityId tokenId = EntityId.of(TOKEN_ID);
EntityId accountId = EntityId.of(PAYER2);
TokenAccount expected = new TokenAccount(tokenId, accountId, dissociateTimeStamp);
expected.setCreatedTimestamp(ASSOCIATE_TIMESTAMP);
expected.setAssociated(false);
expected.setAutomaticAssociation(false);
expected.setFreezeStatus(TokenFreezeStatusEnum.NOT_APPLICABLE);
expected.setKycStatus(TokenKycStatusEnum.NOT_APPLICABLE);
assertThat(latestTokenAccount(TOKEN_ID, PAYER2)).get().isEqualTo(expected);
}
use of com.hedera.mirror.common.domain.entity.EntityId in project hedera-mirror-node by hashgraph.
the class AbstractEntityRecordItemListenerTest method assertRecordTransfers.
protected void assertRecordTransfers(TransactionRecord record) {
long consensusTimestamp = DomainUtils.timeStampInNanos(record.getConsensusTimestamp());
if (entityProperties.getPersist().isCryptoTransferAmounts()) {
TransferList transferList = record.getTransferList();
for (AccountAmount accountAmount : transferList.getAccountAmountsList()) {
EntityId account = EntityId.of(accountAmount.getAccountID());
assertThat(cryptoTransferRepository.findById(new CryptoTransfer.Id(accountAmount.getAmount(), consensusTimestamp, account.getId()))).isPresent();
}
} else {
assertThat(cryptoTransferRepository.count()).isEqualTo(0L);
}
}
use of com.hedera.mirror.common.domain.entity.EntityId in project hedera-mirror-node by hashgraph.
the class ConsensusUpdateTopicTransactionHandlerTest method updateTransactionThrowsWithAliasNotFound.
@ParameterizedTest(name = "{0}")
@EnumSource(value = PartialDataAction.class, names = { "DEFAULT", "ERROR" })
void updateTransactionThrowsWithAliasNotFound(PartialDataAction partialDataAction) {
// given
recordParserProperties.setPartialDataAction(partialDataAction);
var alias = DomainUtils.fromBytes(domainBuilder.key());
var recordItem = recordItemBuilder.consensusUpdateTopic().transactionBody(b -> b.getAutoRenewAccountBuilder().setAlias(alias)).build();
var topicId = EntityId.of(recordItem.getTransactionBody().getConsensusUpdateTopic().getTopicID());
var timestamp = recordItem.getConsensusTimestamp();
var transaction = domainBuilder.transaction().customize(t -> t.consensusTimestamp(timestamp).entityId(topicId)).get();
when(entityIdService.lookup(AccountID.newBuilder().setAlias(alias).build())).thenThrow(new AliasNotFoundException("alias", ACCOUNT));
// when, then
assertThrows(AliasNotFoundException.class, () -> transactionHandler.updateTransaction(transaction, recordItem));
}
use of com.hedera.mirror.common.domain.entity.EntityId in project hedera-mirror-node by hashgraph.
the class ContractCreateTransactionHandlerTest method updateTransactionThrowsWithAliasNotFound.
@ParameterizedTest(name = "{0}")
@EnumSource(value = PartialDataAction.class, names = { "DEFAULT", "ERROR" })
void updateTransactionThrowsWithAliasNotFound(PartialDataAction partialDataAction) {
// given
recordParserProperties.setPartialDataAction(partialDataAction);
var alias = DomainUtils.fromBytes(domainBuilder.key());
var recordItem = recordItemBuilder.contractCreate().transactionBody(b -> b.getAutoRenewAccountIdBuilder().setAlias(alias)).build();
var contractId = EntityId.of(recordItem.getRecord().getReceipt().getContractID());
var timestamp = recordItem.getConsensusTimestamp();
var transaction = domainBuilder.transaction().customize(t -> t.consensusTimestamp(timestamp).entityId(contractId)).get();
when(entityIdService.lookup(AccountID.newBuilder().setAlias(alias).build())).thenThrow(new AliasNotFoundException("alias", ACCOUNT));
// when, then
assertThrows(AliasNotFoundException.class, () -> transactionHandler.updateTransaction(transaction, recordItem));
}
Aggregations