Search in sources :

Example 16 with TopicID

use of com.hederahashgraph.api.proto.java.TopicID in project hedera-mirror-node by hashgraph.

the class ConsensusUpdateTopicTransactionHandlerTest method updateTransactionWithAliasNotFoundAndPartialDataActionSkip.

@Test
void updateTransactionWithAliasNotFoundAndPartialDataActionSkip() {
    recordParserProperties.setPartialDataAction(PartialDataAction.SKIP);
    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));
    transactionHandler.updateTransaction(transaction, recordItem);
    assertConsensusTopicUpdate(timestamp, topicId, Assertions::assertNull);
}
Also used : TOPIC(com.hedera.mirror.common.domain.entity.EntityType.TOPIC) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) TopicID(com.hederahashgraph.api.proto.java.TopicID) PartialDataAction(com.hedera.mirror.importer.parser.PartialDataAction) EntityId(com.hedera.mirror.common.domain.entity.EntityId) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) EnumSource(org.junit.jupiter.params.provider.EnumSource) EntityType(com.hedera.mirror.common.domain.entity.EntityType) Mockito.verifyNoInteractions(org.mockito.Mockito.verifyNoInteractions) RecordParserProperties(com.hedera.mirror.importer.parser.record.RecordParserProperties) TransactionBody(com.hederahashgraph.api.proto.java.TransactionBody) AliasNotFoundException(com.hedera.mirror.importer.exception.AliasNotFoundException) AccountID(com.hederahashgraph.api.proto.java.AccountID) DomainUtils(com.hedera.mirror.common.util.DomainUtils) ResponseCodeEnum(com.hederahashgraph.api.proto.java.ResponseCodeEnum) EntityIdEndec(com.hedera.mirror.common.domain.entity.EntityIdEndec) Range(com.google.common.collect.Range) Mockito.times(org.mockito.Mockito.times) ConsensusUpdateTopicTransactionBody(com.hederahashgraph.api.proto.java.ConsensusUpdateTopicTransactionBody) Mockito.when(org.mockito.Mockito.when) Mockito.verify(org.mockito.Mockito.verify) Entity(com.hedera.mirror.common.domain.entity.Entity) Consumer(java.util.function.Consumer) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Assertions(org.junit.jupiter.api.Assertions) ACCOUNT(com.hedera.mirror.common.domain.entity.EntityType.ACCOUNT) Transaction(com.hedera.mirror.common.domain.transaction.Transaction) AliasNotFoundException(com.hedera.mirror.importer.exception.AliasNotFoundException) Assertions(org.junit.jupiter.api.Assertions) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

TopicID (com.hederahashgraph.api.proto.java.TopicID)16 Test (org.junit.jupiter.api.Test)9 ResponseCodeEnum (com.hederahashgraph.api.proto.java.ResponseCodeEnum)5 EntityId (com.hedera.mirror.common.domain.entity.EntityId)4 Transaction (com.hederahashgraph.api.proto.java.Transaction)4 TransactionBody (com.hederahashgraph.api.proto.java.TransactionBody)4 Consumer (java.util.function.Consumer)4 MoreObjects (com.google.common.base.MoreObjects)3 RecordItem (com.hedera.mirror.common.domain.transaction.RecordItem)3 AccountID (com.hederahashgraph.api.proto.java.AccountID)3 ConsensusSubmitMessageTransactionBody (com.hederahashgraph.api.proto.java.ConsensusSubmitMessageTransactionBody)3 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 Range (com.google.common.collect.Range)2 ByteString (com.google.protobuf.ByteString)2 Entity (com.hedera.mirror.common.domain.entity.Entity)2 EntityIdEndec (com.hedera.mirror.common.domain.entity.EntityIdEndec)2 EntityType (com.hedera.mirror.common.domain.entity.EntityType)2 ACCOUNT (com.hedera.mirror.common.domain.entity.EntityType.ACCOUNT)2 TOPIC (com.hedera.mirror.common.domain.entity.EntityType.TOPIC)2