Search in sources :

Example 1 with TopicIdArgumentConverter

use of com.hedera.mirror.importer.converter.TopicIdArgumentConverter 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

RecordItem (com.hedera.mirror.common.domain.transaction.RecordItem)1 TopicIdArgumentConverter (com.hedera.mirror.importer.converter.TopicIdArgumentConverter)1 TopicID (com.hederahashgraph.api.proto.java.TopicID)1 TransactionID (com.hederahashgraph.api.proto.java.TransactionID)1 Test (org.junit.jupiter.api.Test)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1