Search in sources :

Example 1 with LiveHash

use of com.hedera.mirror.common.domain.transaction.LiveHash in project hedera-mirror-node by hashgraph.

the class EntityRecordItemListenerCryptoTest method cryptoAddLiveHashPersist.

@Test
void cryptoAddLiveHashPersist() {
    Transaction transaction = cryptoAddLiveHashTransaction();
    TransactionBody transactionBody = getTransactionBody(transaction);
    CryptoAddLiveHashTransactionBody cryptoAddLiveHashTransactionBody = transactionBody.getCryptoAddLiveHash();
    TransactionRecord record = transactionRecordSuccess(transactionBody);
    parseRecordItemAndCommit(new RecordItem(transaction, record));
    var dbTransaction = getDbTransaction(record.getConsensusTimestamp());
    LiveHash dbLiveHash = liveHashRepository.findById(dbTransaction.getConsensusTimestamp()).get();
    assertAll(() -> assertEquals(1, transactionRepository.count()), () -> assertEntities(), () -> assertCryptoTransfers(3), () -> assertEquals(1, liveHashRepository.count()), () -> assertTransactionAndRecord(transactionBody, record), () -> assertArrayEquals(cryptoAddLiveHashTransactionBody.getLiveHash().getHash().toByteArray(), dbLiveHash.getLivehash()));
}
Also used : CryptoDeleteLiveHashTransactionBody(com.hederahashgraph.api.proto.java.CryptoDeleteLiveHashTransactionBody) CryptoCreateTransactionBody(com.hederahashgraph.api.proto.java.CryptoCreateTransactionBody) CryptoUpdateTransactionBody(com.hederahashgraph.api.proto.java.CryptoUpdateTransactionBody) TransactionBody(com.hederahashgraph.api.proto.java.TransactionBody) CryptoAddLiveHashTransactionBody(com.hederahashgraph.api.proto.java.CryptoAddLiveHashTransactionBody) Transaction(com.hederahashgraph.api.proto.java.Transaction) SignedTransaction(com.hederahashgraph.api.proto.java.SignedTransaction) CryptoAddLiveHashTransactionBody(com.hederahashgraph.api.proto.java.CryptoAddLiveHashTransactionBody) TransactionRecord(com.hederahashgraph.api.proto.java.TransactionRecord) RecordItem(com.hedera.mirror.common.domain.transaction.RecordItem) LiveHash(com.hedera.mirror.common.domain.transaction.LiveHash) UtilityTest(com.hedera.mirror.importer.util.UtilityTest) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with LiveHash

use of com.hedera.mirror.common.domain.transaction.LiveHash in project hedera-mirror-node by hashgraph.

the class EntityRecordItemListener method insertCryptoAddLiveHash.

private void insertCryptoAddLiveHash(long consensusTimestamp, CryptoAddLiveHashTransactionBody transactionBody) {
    if (entityProperties.getPersist().isClaims()) {
        byte[] liveHash = DomainUtils.toBytes(transactionBody.getLiveHash().getHash());
        entityListener.onLiveHash(new LiveHash(consensusTimestamp, liveHash));
    }
}
Also used : LiveHash(com.hedera.mirror.common.domain.transaction.LiveHash)

Example 3 with LiveHash

use of com.hedera.mirror.common.domain.transaction.LiveHash in project hedera-mirror-node by hashgraph.

the class LiveHashRepositoryTest method save.

@Test
void save() {
    LiveHash liveHash = new LiveHash();
    liveHash.setConsensusTimestamp(1L);
    liveHash.setLivehash("some live hash".getBytes());
    liveHash = liveHashRepository.save(liveHash);
    assertThat(liveHashRepository.findById(liveHash.getId())).get().isEqualTo(liveHash);
}
Also used : LiveHash(com.hedera.mirror.common.domain.transaction.LiveHash) Test(org.junit.jupiter.api.Test)

Example 4 with LiveHash

use of com.hedera.mirror.common.domain.transaction.LiveHash in project hedera-mirror-node by hashgraph.

the class SqlEntityListenerTest method onLiveHash.

@Test
void onLiveHash() {
    // given
    LiveHash expectedLiveHash = new LiveHash(20L, "live hash".getBytes());
    // when
    sqlEntityListener.onLiveHash(expectedLiveHash);
    completeFileAndCommit();
    // then
    assertThat(liveHashRepository.findAll()).containsExactlyInAnyOrder(expectedLiveHash);
}
Also used : LiveHash(com.hedera.mirror.common.domain.transaction.LiveHash) Test(org.junit.jupiter.api.Test) IntegrationTest(com.hedera.mirror.importer.IntegrationTest) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

LiveHash (com.hedera.mirror.common.domain.transaction.LiveHash)4 Test (org.junit.jupiter.api.Test)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 RecordItem (com.hedera.mirror.common.domain.transaction.RecordItem)1 IntegrationTest (com.hedera.mirror.importer.IntegrationTest)1 UtilityTest (com.hedera.mirror.importer.util.UtilityTest)1 CryptoAddLiveHashTransactionBody (com.hederahashgraph.api.proto.java.CryptoAddLiveHashTransactionBody)1 CryptoCreateTransactionBody (com.hederahashgraph.api.proto.java.CryptoCreateTransactionBody)1 CryptoDeleteLiveHashTransactionBody (com.hederahashgraph.api.proto.java.CryptoDeleteLiveHashTransactionBody)1 CryptoUpdateTransactionBody (com.hederahashgraph.api.proto.java.CryptoUpdateTransactionBody)1 SignedTransaction (com.hederahashgraph.api.proto.java.SignedTransaction)1 Transaction (com.hederahashgraph.api.proto.java.Transaction)1 TransactionBody (com.hederahashgraph.api.proto.java.TransactionBody)1 TransactionRecord (com.hederahashgraph.api.proto.java.TransactionRecord)1