Search in sources :

Example 16 with StreamFileData

use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.

the class ProtoBalanceFileReaderTest method supports.

@ParameterizedTest(name = "supports {0}")
@ValueSource(strings = { "2021-03-10T16:00:00Z_Balances.pb.gz", "2021-03-10T16:00:00Z_Balances.pb" })
void supports(String filename) {
    StreamFileData streamFileData = StreamFileData.from(filename, new byte[] { 1, 2, 3 });
    assertThat(protoBalanceFileReader.supports(streamFileData)).isTrue();
}
Also used : StreamFileData(com.hedera.mirror.importer.domain.StreamFileData) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 17 with StreamFileData

use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.

the class ProtoBalanceFileReaderTest method unsupported.

@ParameterizedTest(name = "does not support {0}")
@ValueSource(strings = { "2021-03-10T16:00:00Z_Balances.csv", "2021-03-10T16:00:00Z_Balances.csv.gz" })
void unsupported(String filename) {
    StreamFileData streamFileData = StreamFileData.from(filename, new byte[] { 1, 2, 3 });
    assertThat(protoBalanceFileReader.supports(streamFileData)).isFalse();
}
Also used : StreamFileData(com.hedera.mirror.importer.domain.StreamFileData) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 18 with StreamFileData

use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.

the class EventFileReaderV3Test method readInvalidFileWithNoPrevHash.

@Test
void readInvalidFileWithNoPrevHash() {
    StreamFileData invalidFile = createEventFile(EventFileReaderV3.EVENT_STREAM_FILE_VERSION_3, EventFileReaderV3.EVENT_TYPE_PREV_HASH, null, null);
    assertThrows(InvalidEventFileException.class, () -> eventFileReader.read(invalidFile));
}
Also used : StreamFileData(com.hedera.mirror.importer.domain.StreamFileData) Test(org.junit.jupiter.api.Test)

Example 19 with StreamFileData

use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.

the class EventFileReaderV3Test method readValidFileVersion2.

@Test
void readValidFileVersion2() {
    StreamFileData validFile = createEventFile(EventFileReaderV3.EVENT_STREAM_FILE_VERSION_2, EventFileReaderV3.EVENT_TYPE_PREV_HASH, PREVIOUS_HASH, CONTENT);
    EventFile eventFile = eventFileReader.read(validFile);
    verifyForSuccess(eventFile, validFile, EventFileReaderV3.EVENT_STREAM_FILE_VERSION_2, PREVIOUS_HASH);
}
Also used : StreamFileData(com.hedera.mirror.importer.domain.StreamFileData) EventFile(com.hedera.mirror.common.domain.event.EventFile) Test(org.junit.jupiter.api.Test)

Example 20 with StreamFileData

use of com.hedera.mirror.importer.domain.StreamFileData in project hedera-mirror-node by hashgraph.

the class EventFileReaderV3Test method readValidFileVersion3.

@Test
void readValidFileVersion3() {
    StreamFileData validFile = createEventFile(EventFileReaderV3.EVENT_STREAM_FILE_VERSION_3, EventFileReaderV3.EVENT_TYPE_PREV_HASH, PREVIOUS_HASH, CONTENT);
    EventFile eventFile = eventFileReader.read(validFile);
    verifyForSuccess(eventFile, validFile, EventFileReaderV3.EVENT_STREAM_FILE_VERSION_3, PREVIOUS_HASH);
}
Also used : StreamFileData(com.hedera.mirror.importer.domain.StreamFileData) EventFile(com.hedera.mirror.common.domain.event.EventFile) Test(org.junit.jupiter.api.Test)

Aggregations

StreamFileData (com.hedera.mirror.importer.domain.StreamFileData)51 Test (org.junit.jupiter.api.Test)40 AccountBalanceFile (com.hedera.mirror.common.domain.balance.AccountBalanceFile)8 Path (java.nio.file.Path)6 TestFactory (org.junit.jupiter.api.TestFactory)6 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)6 FileStreamSignature (com.hedera.mirror.importer.domain.FileStreamSignature)4 AllAccountBalances (com.hedera.services.stream.proto.AllAccountBalances)4 UnknownFieldSet (com.google.protobuf.UnknownFieldSet)3 RecordFile (com.hedera.mirror.common.domain.transaction.RecordFile)3 RecordItem (com.hedera.mirror.common.domain.transaction.RecordItem)3 InvalidStreamFileException (com.hedera.mirror.importer.exception.InvalidStreamFileException)3 Instant (java.time.Instant)3 ValueSource (org.junit.jupiter.params.provider.ValueSource)3 AccountBalance (com.hedera.mirror.common.domain.balance.AccountBalance)2 TokenBalance (com.hedera.mirror.common.domain.balance.TokenBalance)2 EntityId (com.hedera.mirror.common.domain.entity.EntityId)2 EventFile (com.hedera.mirror.common.domain.event.EventFile)2 DomainUtils (com.hedera.mirror.common.util.DomainUtils)2 StreamFilename (com.hedera.mirror.importer.domain.StreamFilename)2