Search in sources :

Example 11 with Entity

use of com.hedera.mirror.common.domain.entity.Entity in project hedera-mirror-node by hashgraph.

the class EntityRecordItemListenerFileTest method assertFileEntity.

private void assertFileEntity(FileCreateTransactionBody expected, Timestamp consensusTimestamp) {
    Entity actualFile = getTransactionEntity(consensusTimestamp);
    assertAll(() -> assertFalse(actualFile.getDeleted()), () -> assertEquals(DomainUtils.timeStampInNanos(expected.getExpirationTime()), actualFile.getExpirationTimestamp()), () -> assertEquals(expected.getMemo(), actualFile.getMemo()), () -> assertArrayEquals(expected.getKeys().toByteArray(), actualFile.getKey()), () -> assertNull(actualFile.getAutoRenewPeriod()), () -> assertNull(actualFile.getProxyAccountId()));
}
Also used : Entity(com.hedera.mirror.common.domain.entity.Entity)

Example 12 with Entity

use of com.hedera.mirror.common.domain.entity.Entity in project hedera-mirror-node by hashgraph.

the class EntityRecordItemListenerFileTest method fileDeleteToNew.

@Test
void fileDeleteToNew() {
    Transaction fileDeleteTransaction = fileDeleteTransaction();
    TransactionBody transactionBody = getTransactionBody(fileDeleteTransaction);
    TransactionRecord record = transactionRecord(transactionBody);
    parseRecordItemAndCommit(new RecordItem(fileDeleteTransaction, record));
    Entity fileEntity = getTransactionEntity(record.getConsensusTimestamp());
    assertAll(() -> assertRowCountOnSuccessNoData(FILE_ID), () -> assertTransactionAndRecord(transactionBody, record), () -> assertFileEntityHasNullFields(record.getConsensusTimestamp()), () -> assertTrue(fileEntity.getDeleted()));
}
Also used : Entity(com.hedera.mirror.common.domain.entity.Entity) FileAppendTransactionBody(com.hederahashgraph.api.proto.java.FileAppendTransactionBody) TransactionBody(com.hederahashgraph.api.proto.java.TransactionBody) FileUpdateTransactionBody(com.hederahashgraph.api.proto.java.FileUpdateTransactionBody) FileCreateTransactionBody(com.hederahashgraph.api.proto.java.FileCreateTransactionBody) Transaction(com.hederahashgraph.api.proto.java.Transaction) TransactionRecord(com.hederahashgraph.api.proto.java.TransactionRecord) RecordItem(com.hedera.mirror.common.domain.transaction.RecordItem) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 13 with Entity

use of com.hedera.mirror.common.domain.entity.Entity in project hedera-mirror-node by hashgraph.

the class EntityRecordItemListenerFileTest method fileUpdateContentsToNew.

@Test
void fileUpdateContentsToNew() {
    Transaction transaction = fileUpdateContentsTransaction();
    TransactionBody transactionBody = getTransactionBody(transaction);
    TransactionRecord record = transactionRecord(transactionBody);
    parseRecordItemAndCommit(new RecordItem(transaction, record));
    Entity actualFile = getTransactionEntity(record.getConsensusTimestamp());
    assertAll(() -> assertRowCountOnSuccess(FILE_ID), () -> assertTransactionAndRecord(transactionBody, record), () -> assertFileData(transactionBody.getFileUpdate().getContents(), record.getConsensusTimestamp()), // Additional entity checks
    () -> assertFalse(actualFile.getDeleted()), () -> assertNull(actualFile.getKey()), () -> assertNull(actualFile.getAutoRenewPeriod()), () -> assertNull(actualFile.getProxyAccountId()));
}
Also used : Entity(com.hedera.mirror.common.domain.entity.Entity) FileAppendTransactionBody(com.hederahashgraph.api.proto.java.FileAppendTransactionBody) TransactionBody(com.hederahashgraph.api.proto.java.TransactionBody) FileUpdateTransactionBody(com.hederahashgraph.api.proto.java.FileUpdateTransactionBody) FileCreateTransactionBody(com.hederahashgraph.api.proto.java.FileCreateTransactionBody) Transaction(com.hederahashgraph.api.proto.java.Transaction) TransactionRecord(com.hederahashgraph.api.proto.java.TransactionRecord) RecordItem(com.hedera.mirror.common.domain.transaction.RecordItem) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 14 with Entity

use of com.hedera.mirror.common.domain.entity.Entity in project hedera-mirror-node by hashgraph.

the class EntityRecordItemListenerFileTest method assertFileEntity.

private void assertFileEntity(FileUpdateTransactionBody expected, Timestamp consensusTimestamp) {
    Entity actualFile = getTransactionEntity(consensusTimestamp);
    assertAll(() -> assertEquals(DomainUtils.timeStampInNanos(expected.getExpirationTime()), actualFile.getExpirationTimestamp()), () -> assertFalse(actualFile.getDeleted()), () -> assertEquals(expected.getMemo().getValue(), actualFile.getMemo()), () -> assertArrayEquals(expected.getKeys().toByteArray(), actualFile.getKey()), () -> assertNull(actualFile.getAutoRenewPeriod()), () -> assertNull(actualFile.getProxyAccountId()));
}
Also used : Entity(com.hedera.mirror.common.domain.entity.Entity)

Example 15 with Entity

use of com.hedera.mirror.common.domain.entity.Entity in project hedera-mirror-node by hashgraph.

the class EntityRecordItemListenerFileTest method assertFileEntityHasNullFields.

private void assertFileEntityHasNullFields(Timestamp consensusTimestamp) {
    Entity actualFile = getTransactionEntity(consensusTimestamp);
    assertAll(() -> assertNull(actualFile.getKey()), () -> assertNull(actualFile.getExpirationTimestamp()), () -> assertNull(actualFile.getAutoRenewPeriod()), () -> assertNull(actualFile.getProxyAccountId()));
}
Also used : Entity(com.hedera.mirror.common.domain.entity.Entity)

Aggregations

Entity (com.hedera.mirror.common.domain.entity.Entity)78 Test (org.junit.jupiter.api.Test)52 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)40 RecordItem (com.hedera.mirror.common.domain.transaction.RecordItem)23 TransactionBody (com.hederahashgraph.api.proto.java.TransactionBody)22 IntegrationTest (com.hedera.mirror.importer.IntegrationTest)21 Transaction (com.hederahashgraph.api.proto.java.Transaction)19 TransactionRecord (com.hederahashgraph.api.proto.java.TransactionRecord)16 AbstractEntity (com.hedera.mirror.common.domain.entity.AbstractEntity)15 EntityId (com.hedera.mirror.common.domain.entity.EntityId)15 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)14 AccountID (com.hederahashgraph.api.proto.java.AccountID)11 CryptoUpdateTransactionBody (com.hederahashgraph.api.proto.java.CryptoUpdateTransactionBody)10 ByteString (com.google.protobuf.ByteString)9 Contract (com.hedera.mirror.common.domain.contract.Contract)9 FileAppendTransactionBody (com.hederahashgraph.api.proto.java.FileAppendTransactionBody)9 FileCreateTransactionBody (com.hederahashgraph.api.proto.java.FileCreateTransactionBody)9 FileUpdateTransactionBody (com.hederahashgraph.api.proto.java.FileUpdateTransactionBody)9 Resource (javax.annotation.Resource)9 Assertions (org.junit.jupiter.api.Assertions)9