Search in sources :

Example 31 with RecordFile

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

the class RecordFileParserTest method allFiltered.

@Test
void allFiltered() {
    RecordFile recordFile = (RecordFile) getStreamFile();
    when(mirrorDateRangePropertiesProcessor.getDateRangeFilter(parserProperties.getStreamType())).thenReturn(DateRangeFilter.empty());
    parser.parse(recordFile);
    verifyNoInteractions(recordItemListener);
    verify(recordStreamFileListener).onEnd(recordFile);
    assertPostParseStreamFile(recordFile, true);
}
Also used : RecordFile(com.hedera.mirror.common.domain.transaction.RecordFile) AbstractStreamFileParserTest(com.hedera.mirror.importer.parser.AbstractStreamFileParserTest) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 32 with RecordFile

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

the class RecordFileParserTest method assertParsed.

@Override
protected void assertParsed(StreamFile streamFile, boolean parsed, boolean dbError) {
    RecordFile recordFile = (RecordFile) streamFile;
    if (parsed) {
        verify(recordItemListener).onItem(recordItem);
        verify(recordStreamFileListener).onEnd(recordFile);
        verify(recordStreamFileListener, never()).onError();
    } else {
        if (dbError) {
            verify(recordStreamFileListener, never()).onEnd(recordFile);
            verify(recordStreamFileListener).onError();
        } else {
            verify(recordStreamFileListener, never()).onStart();
        }
    }
}
Also used : RecordFile(com.hedera.mirror.common.domain.transaction.RecordFile)

Example 33 with RecordFile

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

the class AbstractEntityRecordItemListenerTest method parseRecordItemAndCommit.

protected void parseRecordItemAndCommit(RecordItem recordItem) {
    transactionTemplate.executeWithoutResult(status -> {
        Instant instant = Instant.ofEpochSecond(0, recordItem.getConsensusTimestamp());
        String filename = StreamFilename.getFilename(StreamType.RECORD, DATA, instant);
        long consensusStart = recordItem.getConsensusTimestamp();
        RecordFile recordFile = recordFile(consensusStart, consensusStart + 1, filename);
        recordStreamFileListener.onStart();
        entityRecordItemListener.onItem(recordItem);
        // commit, close connection
        recordStreamFileListener.onEnd(recordFile);
    });
}
Also used : RecordFile(com.hedera.mirror.common.domain.transaction.RecordFile) Instant(java.time.Instant) ByteString(com.google.protobuf.ByteString)

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