Search in sources :

Example 11 with RecordFile

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

the class TestRecordFiles method getV2V5Files.

public List<RecordFile> getV2V5Files() {
    EntityId nodeAccountId = EntityId.of(0, 0, 3, EntityType.ACCOUNT);
    RecordFile recordFileV2 = RecordFile.builder().consensusStart(1611188151568507001L).consensusEnd(1611188151568507001L).count(1L).digestAlgorithm(DigestAlgorithm.SHA384).fileHash("e7d9e71efd239bde3adcad8eb0571c38f91f77ae76a4af69bb44f19b2785ad3594ac1d265351a592ab14301da9bb1950").hash("e7d9e71efd239bde3adcad8eb0571c38f91f77ae76a4af69bb44f19b2785ad3594ac1d265351a592ab14301da9bb1950").name("2021-01-21T00_15_51.568507001Z.rcd").nodeAccountId(nodeAccountId).previousHash("d27ba83c736bfa2ffc9a6f062b27ea4856800bbbe820b77b32e08faf3d7475d81ef5a16f90ce065d35eefa999677edaa").version(2).build();
    RecordFile recordFileV5 = RecordFile.builder().consensusStart(1611188383558496000L).consensusEnd(1611188383558496000L).count(1L).digestAlgorithm(DigestAlgorithm.SHA384).fileHash("42717bae0e538bac34563784b08b5a5b50a9964c9435452c93134bf13355c9778a1c64cfdc30f33fe52dd7f76dbdda70").hapiVersionMajor(0).hapiVersionMinor(11).hapiVersionPatch(0).hash("e6c1d7bfe956b6b2c8061bee5c43e512111cbccb21099bb0c49e2a7c74cf617cf5b6bf65070f29eb43a80d9cef2d8242").metadataHash("1d83206a166a06c8579f9de637cf50a565341928b55bfbdc774ce85ac2169b46c23db42729723e7c39e5a042bd9e3b98").name("2021-01-21T00_19_43.558496000Z.rcd").nodeAccountId(nodeAccountId).previousHash(recordFileV2.getHash()).version(5).build();
    return List.of(recordFileV2, recordFileV5);
}
Also used : EntityId(com.hedera.mirror.common.domain.entity.EntityId) RecordFile(com.hedera.mirror.common.domain.transaction.RecordFile)

Example 12 with RecordFile

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

the class ContractResultServiceImplIntegrationTest method parseRecordItemAndCommit.

protected void parseRecordItemAndCommit(RecordItem recordItem, Transaction transaction) {
    transactionTemplate.executeWithoutResult(status -> {
        Instant instant = Instant.ofEpochSecond(0, recordItem.getConsensusTimestamp());
        String filename = StreamFilename.getFilename(StreamType.RECORD, DATA, instant);
        long consensusStart = recordItem.getConsensusTimestamp();
        RecordFile recordFile = domainBuilder.recordFile().customize(x -> x.consensusStart(consensusStart).consensusEnd(consensusStart + 1).name(filename)).get();
        recordStreamFileListener.onStart();
        contractResultService.process(recordItem, transaction);
        // commit, close connection
        recordStreamFileListener.onEnd(recordFile);
    });
}
Also used : EntityId(com.hedera.mirror.common.domain.entity.EntityId) ContractResultRepository(com.hedera.mirror.importer.repository.ContractResultRepository) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) RequiredArgsConstructor(lombok.RequiredArgsConstructor) Autowired(org.springframework.beans.factory.annotation.Autowired) StringUtils(org.apache.commons.lang3.StringUtils) ArrayList(java.util.ArrayList) ContractID(com.hederahashgraph.api.proto.java.ContractID) DomainBuilder(com.hedera.mirror.common.domain.DomainBuilder) RecordFile(com.hedera.mirror.common.domain.transaction.RecordFile) ContractStateChangeRepository(com.hedera.mirror.importer.repository.ContractStateChangeRepository) RecordItemBuilder(com.hedera.mirror.importer.parser.domain.RecordItemBuilder) ContractResult(com.hedera.mirror.common.domain.contract.ContractResult) DomainUtils(com.hedera.mirror.common.util.DomainUtils) ContractStateChange(com.hedera.mirror.common.domain.contract.ContractStateChange) ResponseCodeEnum(com.hederahashgraph.api.proto.java.ResponseCodeEnum) RecordStreamFileListener(com.hedera.mirror.importer.parser.record.RecordStreamFileListener) DATA(com.hedera.mirror.importer.domain.StreamFilename.FileType.DATA) StreamType(com.hedera.mirror.common.domain.StreamType) ContractLog(com.hedera.mirror.common.domain.contract.ContractLog) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) ByteString(com.google.protobuf.ByteString) Test(org.junit.jupiter.api.Test) IntegrationTest(com.hedera.mirror.importer.IntegrationTest) TokenType(com.hederahashgraph.api.proto.java.TokenType) ContractLogRepository(com.hedera.mirror.importer.repository.ContractLogRepository) ObjectAssert(org.assertj.core.api.ObjectAssert) TransactionTemplate(org.springframework.transaction.support.TransactionTemplate) ContractFunctionResult(com.hederahashgraph.api.proto.java.ContractFunctionResult) RecordItem(com.hedera.mirror.common.domain.transaction.RecordItem) Transaction(com.hedera.mirror.common.domain.transaction.Transaction) RecordFile(com.hedera.mirror.common.domain.transaction.RecordFile) Instant(java.time.Instant) ByteString(com.google.protobuf.ByteString)

Example 13 with RecordFile

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

the class RecordFileV2DownloaderTest method getRecordFileMap.

@Override
protected Map<String, RecordFile> getRecordFileMap() {
    Map<String, RecordFile> allRecordFileMap = TestRecordFiles.getAll();
    RecordFile recordFile1 = allRecordFileMap.get("2019-08-30T18_10_00.419072Z.rcd");
    RecordFile recordFile2 = allRecordFileMap.get("2019-08-30T18_10_05.249678Z.rcd");
    return Map.of(recordFile1.getName(), recordFile1, recordFile2.getName(), recordFile2);
}
Also used : RecordFile(com.hedera.mirror.common.domain.transaction.RecordFile)

Example 14 with RecordFile

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

the class RecordFileV2V5DownloaderTest method getRecordFileMap.

@Override
protected Map<String, RecordFile> getRecordFileMap() {
    List<RecordFile> recordFiles = TestRecordFiles.getV2V5Files();
    RecordFile recordFileV2 = recordFiles.get(0);
    RecordFile recordFileV5 = recordFiles.get(1);
    return Map.of(recordFileV2.getName(), recordFileV2, recordFileV5.getName(), recordFileV5);
}
Also used : RecordFile(com.hedera.mirror.common.domain.transaction.RecordFile)

Example 15 with RecordFile

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

the class RecordFileRepositoryTest method findLatestIndex.

@Test
void findLatestIndex() {
    RecordFile recordFile1 = recordFile();
    recordFileRepository.save(recordFile1);
    RecordFile recordFile2 = recordFile();
    recordFileRepository.save(recordFile2);
    assertThat(recordFileRepository.findLatestIndex()).get().isEqualTo(recordFile2.getIndex());
}
Also used : RecordFile(com.hedera.mirror.common.domain.transaction.RecordFile) Test(org.junit.jupiter.api.Test) Web3IntegrationTest(com.hedera.mirror.web3.Web3IntegrationTest)

Aggregations

RecordFile (com.hedera.mirror.common.domain.transaction.RecordFile)33 Test (org.junit.jupiter.api.Test)9 RecordItem (com.hedera.mirror.common.domain.transaction.RecordItem)8 Instant (java.time.Instant)5 ByteString (com.google.protobuf.ByteString)4 IntegrationTest (com.hedera.mirror.importer.IntegrationTest)4 EntityId (com.hedera.mirror.common.domain.entity.EntityId)3 StreamFileData (com.hedera.mirror.importer.domain.StreamFileData)3 StreamFileReaderException (com.hedera.mirror.importer.exception.StreamFileReaderException)3 IOException (java.io.IOException)3 Path (java.nio.file.Path)3 ArrayList (java.util.ArrayList)3 Collectors (java.util.stream.Collectors)3 RequiredArgsConstructor (lombok.RequiredArgsConstructor)3 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)3 TestFactory (org.junit.jupiter.api.TestFactory)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 MirrorProperties (com.hedera.mirror.importer.MirrorProperties)2 PREVIEWNET (com.hedera.mirror.importer.MirrorProperties.HederaNetwork.PREVIEWNET)2 TESTNET (com.hedera.mirror.importer.MirrorProperties.HederaNetwork.TESTNET)2