use of com.hedera.mirror.common.domain.entity.EntityType.CONTRACT in project hedera-mirror-node by hashgraph.
the class EntityIdServiceImplTest method lookupContractCreate2EvmAddressDeleted.
@Test
void lookupContractCreate2EvmAddressDeleted() {
Contract contract = domainBuilder.contract().customize((b) -> b.deleted(true)).persist();
assertThrows(AliasNotFoundException.class, () -> entityIdService.lookup(getProtoContractId(contract)));
}
use of com.hedera.mirror.common.domain.entity.EntityType.CONTRACT in project hedera-mirror-node by hashgraph.
the class EntityIdServiceImplTest method storeContract.
@ParameterizedTest
@CsvSource(value = { "false", "," })
void storeContract(Boolean deleted) {
Contract contract = domainBuilder.contract().customize(c -> c.deleted(deleted)).get();
entityIdService.notify(contract);
assertThat(entityIdService.lookup(getProtoContractId(contract))).isEqualTo(contract.toEntityId());
}
use of com.hedera.mirror.common.domain.entity.EntityType.CONTRACT in project hedera-mirror-node by hashgraph.
the class EntityIdServiceImplTest method storeContractDeleted.
@Test
void storeContractDeleted() {
Contract contract = domainBuilder.contract().customize(c -> c.deleted(true)).get();
entityIdService.notify(contract);
assertThrows(AliasNotFoundException.class, () -> entityIdService.lookup(getProtoContractId(contract)));
}
use of com.hedera.mirror.common.domain.entity.EntityType.CONTRACT in project hedera-mirror-node by hashgraph.
the class ContractCreateTransactionHandlerTest method updateTransactionWithAliasNotFoundAndPartialDataActionSkip.
@Test
void updateTransactionWithAliasNotFoundAndPartialDataActionSkip() {
recordParserProperties.setPartialDataAction(PartialDataAction.SKIP);
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));
transactionHandler.updateTransaction(transaction, recordItem);
assertContract(contractId, timestamp, t -> assertThat(t).returns(null, Contract::getAutoRenewAccountId).returns(null, Contract::getEvmAddress).satisfies(c -> assertThat(c.getFileId().getId()).isPositive()).returns(null, Contract::getInitcode));
}
use of com.hedera.mirror.common.domain.entity.EntityType.CONTRACT in project hedera-mirror-node by hashgraph.
the class ContractUpdateTransactionHandlerTest method updateTransactionWithAliasNotFoundAndPartialDataActionSkip.
@Test
void updateTransactionWithAliasNotFoundAndPartialDataActionSkip() {
recordParserProperties.setPartialDataAction(PartialDataAction.SKIP);
var alias = DomainUtils.fromBytes(domainBuilder.key());
var recordItem = recordItemBuilder.contractUpdate().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));
transactionHandler.updateTransaction(transaction, recordItem);
assertContractUpdate(timestamp, contractId, t -> assertThat(t).returns(null, Contract::getAutoRenewAccountId).satisfies(c -> assertThat(c.getAutoRenewPeriod()).isPositive()).satisfies(c -> assertThat(c.getExpirationTimestamp()).isPositive()).satisfies(c -> assertThat(c.getKey()).isNotEmpty()).satisfies(c -> assertThat(c.getMaxAutomaticTokenAssociations()).isPositive()).satisfies(c -> assertThat(c.getMemo()).isNotEmpty()).satisfies(c -> assertThat(c.getPublicKey()).isNotEmpty()).satisfies(c -> assertThat(c.getProxyAccountId().getId()).isPositive()));
}
Aggregations