Search in sources :

Example 21 with TransactionID

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

the class EntityRecordItemListenerTopicTest method submitMessageTestFiltered.

@Test
void submitMessageTestFiltered() {
    // given
    var responseCode = SUCCESS;
    var topicId = (TopicID) new TopicIdArgumentConverter().convert("0.0.999", // excluded in application-default.yml
    null);
    var consensusTimestamp = 10_000_000L;
    var message = "message";
    var sequenceNumber = 10_000L;
    var runningHash = "running-hash";
    var runningHashVersion = 1;
    var chunkNum = 3;
    var chunkTotal = 5;
    var validStartNs = 7L;
    var scheduled = false;
    var nonce = 0;
    TransactionID initialTransactionId = createTransactionID(PAYER_ACCOUNT_ID.getEntityNum(), TestUtils.toTimestamp(validStartNs), scheduled, nonce);
    var transaction = createSubmitMessageTransaction(topicId, message, chunkNum, chunkTotal, initialTransactionId);
    var transactionRecord = createTransactionRecord(topicId, sequenceNumber, runningHash.getBytes(), runningHashVersion, consensusTimestamp, responseCode);
    // when
    parseRecordItemAndCommit(new RecordItem(transaction, transactionRecord));
    // then
    // if the transaction is filtered out, nothing in it should affect the state
    assertEquals(0L, entityRepository.count());
    assertEquals(0L, topicMessageRepository.count());
}
Also used : TopicIdArgumentConverter(com.hedera.mirror.importer.converter.TopicIdArgumentConverter) TopicID(com.hederahashgraph.api.proto.java.TopicID) RecordItem(com.hedera.mirror.common.domain.transaction.RecordItem) TransactionID(com.hederahashgraph.api.proto.java.TransactionID) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

TransactionID (com.hederahashgraph.api.proto.java.TransactionID)21 Test (org.junit.jupiter.api.Test)13 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)8 RecordItem (com.hedera.mirror.common.domain.transaction.RecordItem)7 Instant (java.time.Instant)5 TransactionBody (com.hederahashgraph.api.proto.java.TransactionBody)4 ByteString (com.google.protobuf.ByteString)3 HapiSpecSetup (com.hedera.services.bdd.spec.HapiSpecSetup)3 AccountID (com.hederahashgraph.api.proto.java.AccountID)3 List (java.util.List)3 AtomicReference (java.util.concurrent.atomic.AtomicReference)3 HapiApiSpec (com.hedera.services.bdd.spec.HapiApiSpec)2 HapiApiSpec.defaultHapiSpec (com.hedera.services.bdd.spec.HapiApiSpec.defaultHapiSpec)2 TransactionRecordAsserts.recordWith (com.hedera.services.bdd.spec.assertions.TransactionRecordAsserts.recordWith)2 QueryVerbs.getAccountBalance (com.hedera.services.bdd.spec.queries.QueryVerbs.getAccountBalance)2 QueryVerbs.getAccountInfo (com.hedera.services.bdd.spec.queries.QueryVerbs.getAccountInfo)2 QueryVerbs.getScheduleInfo (com.hedera.services.bdd.spec.queries.QueryVerbs.getScheduleInfo)2 QueryVerbs.getTokenInfo (com.hedera.services.bdd.spec.queries.QueryVerbs.getTokenInfo)2 QueryVerbs.getTopicInfo (com.hedera.services.bdd.spec.queries.QueryVerbs.getTopicInfo)2 QueryVerbs.getTxnRecord (com.hedera.services.bdd.spec.queries.QueryVerbs.getTxnRecord)2