use of com.hedera.mirror.common.domain.entity.EntityType.ACCOUNT in project hedera-mirror-node by hashgraph.
the class TokenUpdateTransactionHandlerTest 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.tokenUpdate().transactionBody(b -> b.getAutoRenewAccountBuilder().setAlias(alias)).build();
var tokenId = EntityId.of(recordItem.getTransactionBody().getTokenUpdate().getToken());
var timestamp = recordItem.getConsensusTimestamp();
var transaction = domainBuilder.transaction().customize(t -> t.consensusTimestamp(timestamp).entityId(tokenId)).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.EntityType.ACCOUNT in project hedera-mirror-node by hashgraph.
the class TokenTransferRepositoryTest method findById.
@Test
void findById() {
EntityId tokenId = EntityId.of(0L, 1L, 20L, TOKEN);
EntityId accountId = EntityId.of(0L, 1L, 7L, ACCOUNT);
EntityId payerAccountId = EntityId.of(0L, 1L, 500L, ACCOUNT);
long amount = 40L;
TokenTransfer tokenTransfer = domainBuilder.tokenTransfer().customize(t -> t.amount(amount).id(new TokenTransfer.Id(1L, tokenId, accountId)).payerAccountId(payerAccountId).tokenDissociate(false)).get();
tokenTransferRepository.save(tokenTransfer);
assertThat(tokenTransferRepository.findById(tokenTransfer.getId())).get().isEqualTo(tokenTransfer);
}
use of com.hedera.mirror.common.domain.entity.EntityType.ACCOUNT in project hedera-mirror-node by hashgraph.
the class DomainBuilder method addressBookEntry.
public DomainWrapper<AddressBookEntry, AddressBookEntry.AddressBookEntryBuilder> addressBookEntry(int endpoints) {
long consensusTimestamp = timestamp();
long nodeId = id();
var builder = AddressBookEntry.builder().consensusTimestamp(consensusTimestamp).description(text(10)).memo(text(10)).nodeId(nodeId).nodeAccountId(EntityId.of(0L, 0L, nodeId + 3, ACCOUNT)).nodeCertHash(bytes(96)).publicKey(text(64)).stake(0L);
var serviceEndpoints = new HashSet<AddressBookServiceEndpoint>();
builder.serviceEndpoints(serviceEndpoints);
for (int i = 0; i < endpoints; ++i) {
var endpoint = addressBookServiceEndpoint().customize(a -> a.consensusTimestamp(consensusTimestamp).nodeId(nodeId)).get();
serviceEndpoints.add(endpoint);
}
return new DomainWrapperImpl<>(builder, builder::build);
}
use of com.hedera.mirror.common.domain.entity.EntityType.ACCOUNT in project hedera-mirror-node by hashgraph.
the class EntityIdServiceImplTest method storeAccountDeleted.
@Test
void storeAccountDeleted() {
Entity account = domainBuilder.entity().customize(e -> e.deleted(true)).get();
entityIdService.notify(account);
assertThrows(AliasNotFoundException.class, () -> entityIdService.lookup(getProtoAccountId(account)));
}
use of com.hedera.mirror.common.domain.entity.EntityType.ACCOUNT in project hedera-mirror-node by hashgraph.
the class EntityIdServiceImplTest method storeAccount.
@ParameterizedTest
@CsvSource(value = { "false", "," })
void storeAccount(Boolean deleted) {
Entity account = domainBuilder.entity().customize(e -> e.deleted(deleted)).get();
entityIdService.notify(account);
assertThat(entityIdService.lookup(getProtoAccountId(account))).isEqualTo(account.toEntityId());
}
Aggregations