use of com.hedera.mirror.common.domain.transaction.Transaction in project hedera-mirror-node by hashgraph.
the class CryptoApproveAllowanceTransactionHandlerTest method updateTransactionUnsuccessful.
@Test
void updateTransactionUnsuccessful() {
var transaction = new Transaction();
RecordItem recordItem = recordItemBuilder.cryptoApproveAllowance().receipt(r -> r.setStatus(ResponseCodeEnum.ACCOUNT_DELETED)).build();
transactionHandler.updateTransaction(transaction, recordItem);
verifyNoInteractions(entityListener);
}
use of com.hedera.mirror.common.domain.transaction.Transaction in project hedera-mirror-node by hashgraph.
the class CryptoCreateTransactionHandlerTest method updateTransactionStakedAccountId.
@Test
void updateTransactionStakedAccountId() {
// given
final AccountID accountId = AccountID.newBuilder().setAccountNum(1L).build();
var recordItem = recordItemBuilder.cryptoCreate().transactionBody(b -> b.setDeclineReward(false).setStakedAccountId(accountId)).build();
// when
transactionHandler.updateTransaction(transaction(recordItem), recordItem);
// then
verify(entityListener).onEntity(entities.capture());
assertThat(entities.getValue()).isNotNull().returns(false, Entity::isDeclineReward).returns(accountId.getAccountNum(), Entity::getStakedAccountId).returns(Utility.getEpochDay(recordItem.getConsensusTimestamp()), Entity::getStakePeriodStart);
}
use of com.hedera.mirror.common.domain.transaction.Transaction in project hedera-mirror-node by hashgraph.
the class TokenUpdateTransactionHandlerTest method updateTransactionWithAliasNotFoundAndPartialDataActionSkip.
@Test
void updateTransactionWithAliasNotFoundAndPartialDataActionSkip() {
recordParserProperties.setPartialDataAction(PartialDataAction.SKIP);
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));
transactionHandler.updateTransaction(transaction, recordItem);
assertTokenUpdate(timestamp, tokenId, Assertions::assertNull);
}
use of com.hedera.mirror.common.domain.transaction.Transaction 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.transaction.Transaction in project hedera-mirror-node by hashgraph.
the class TokenUpdateTransactionHandlerTest method updateTransactionUnsuccessful.
@Test
void updateTransactionUnsuccessful() {
RecordItem recordItem = recordItemBuilder.tokenUpdate().receipt(r -> r.setStatus(ResponseCodeEnum.ACCOUNT_DELETED)).build();
var transaction = new Transaction();
transactionHandler.updateTransaction(transaction, recordItem);
verifyNoInteractions(entityListener);
}
Aggregations