use of com.hedera.mirror.common.domain.transaction.RecordItem in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerTopicTest method createTopicTestError.
@Test
void createTopicTestError() {
var consensusTimestamp = 3_000_000L;
var responseCode = INSUFFICIENT_ACCOUNT_BALANCE;
var transaction = createCreateTopicTransaction(null, null, "memo", null, null);
var transactionRecord = createTransactionRecord(null, consensusTimestamp, responseCode);
parseRecordItemAndCommit(new RecordItem(transaction, transactionRecord));
assertTransactionInRepository(responseCode, consensusTimestamp, null);
assertEquals(0L, entityRepository.count());
}
use of com.hedera.mirror.common.domain.transaction.RecordItem in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerTopicTest method submitMessageTestTopicNotFound.
@Test
void submitMessageTestTopicNotFound() {
var responseCode = SUCCESS;
var consensusTimestamp = 10_000_000L;
var message = "message";
var sequenceNumber = 10_000L;
var runningHash = "running-hash";
var runningHashVersion = 2;
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 topicMessage = createTopicMessage(TOPIC_ID, message, sequenceNumber, runningHash, consensusTimestamp, runningHashVersion, chunkNum, chunkTotal, PAYER_ACCOUNT_ID, initialTransactionId);
var transaction = createSubmitMessageTransaction(TOPIC_ID, message, chunkNum, chunkTotal, initialTransactionId);
var transactionRecord = createTransactionRecord(TOPIC_ID, sequenceNumber, runningHash.getBytes(), runningHashVersion, consensusTimestamp, responseCode);
parseRecordItemAndCommit(new RecordItem(transaction, transactionRecord));
assertTransactionInRepository(responseCode, consensusTimestamp, TOPIC_ID.getTopicNum());
assertEquals(0L, entityRepository.count());
assertEquals(1L, topicMessageRepository.count());
assertThat(topicMessageRepository.findById(consensusTimestamp)).get().isEqualTo(topicMessage);
}
use of com.hedera.mirror.common.domain.transaction.RecordItem in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerTopicTest method updateTopicTest.
@ParameterizedTest
@CsvSource({ "11, 21, updated-admin-key, updated-submit-key, updated-memo, 1, 30", "11, 21, '', '', '', 0, 30", "11, 21, updated-admin-key, updated-submit-key, updated-memo, ," })
void updateTopicTest(long updatedExpirationTimeSeconds, int updatedExpirationTimeNanos, @ConvertWith(KeyConverter.class) Key updatedAdminKey, @ConvertWith(KeyConverter.class) Key updatedSubmitKey, String updatedMemo, Long autoRenewAccountId, Long autoRenewPeriod) {
var topic = domainBuilder.topic().persist();
var updateTimestamp = topic.getCreatedTimestamp() + 100L;
var topicId = TopicID.newBuilder().setTopicNum(topic.getNum()).build();
var transaction = createUpdateTopicTransaction(topicId, updatedExpirationTimeSeconds, updatedExpirationTimeNanos, updatedAdminKey, updatedSubmitKey, updatedMemo, autoRenewAccountId, autoRenewPeriod);
var transactionRecord = createTransactionRecord(topicId, updateTimestamp, SUCCESS);
var expectedAutoRenewAccountId = autoRenewAccountId == null ? topic.getAutoRenewAccountId() : autoRenewAccountId;
var expectedAutoRenewPeriod = autoRenewPeriod == null ? topic.getAutoRenewPeriod() : autoRenewPeriod;
var expected = createTopicEntity(topicId, updatedExpirationTimeSeconds, updatedExpirationTimeNanos, updatedAdminKey, updatedSubmitKey, updatedMemo, expectedAutoRenewAccountId, expectedAutoRenewPeriod);
expected.setCreatedTimestamp(topic.getCreatedTimestamp());
expected.setDeleted(false);
expected.setTimestampLower(updateTimestamp);
parseRecordItemAndCommit(new RecordItem(transaction, transactionRecord));
assertTransactionInRepository(SUCCESS, updateTimestamp, topic.getId());
assertEntity(expected);
assertEquals(1L, entityRepository.count());
}
use of com.hedera.mirror.common.domain.transaction.RecordItem in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerTopicTest method deleteTopicTestTopicNotFound.
@Test
void deleteTopicTestTopicNotFound() {
var consensusTimestamp = 10_000_000L;
var responseCode = SUCCESS;
// Setup expected data
var topic = createTopicEntity(TOPIC_ID, null, null, null, null, "", null, null);
topic.setDeleted(true);
topic.setTimestampLower(consensusTimestamp);
// Topic not saved to the repository.
var transaction = createDeleteTopicTransaction(TOPIC_ID);
var transactionRecord = createTransactionRecord(TOPIC_ID, consensusTimestamp, responseCode);
parseRecordItemAndCommit(new RecordItem(transaction, transactionRecord));
var entity = getTopicEntity(TOPIC_ID);
assertTransactionInRepository(responseCode, consensusTimestamp, entity.getId());
assertEquals(1L, entityRepository.count());
assertThat(entity).isEqualTo(topic);
}
use of com.hedera.mirror.common.domain.transaction.RecordItem in project hedera-mirror-node by hashgraph.
the class TransactionSignatureTest method transactionSignatureEnabled.
@ParameterizedTest
@EnumSource(value = TransactionType.class, names = "UNKNOWN", mode = EXCLUDE)
void transactionSignatureEnabled(TransactionType transactionType) {
transactionSignatures.clear();
transactionSignatures.add(transactionType);
RecordItem recordItem = getRecordItem(transactionType, SUCCESS);
entityRecordItemListener.onItem(recordItem);
assertTransactionSignatures(defaultTransactionSignatures);
}
Aggregations