use of com.hedera.mirror.common.domain.StreamType in project hedera-mirror-node by hashgraph.
the class MirrorDateRangePropertiesProcessorTest method startDateAfterDatabase.
@ParameterizedTest(name = "startDate is {0}ns after application status")
@ValueSource(longs = { 1, 2_000_000_000L, 200_000_000_000L })
void startDateAfterDatabase(long diffNanos) {
Instant lastFileInstant = Instant.now().minusSeconds(200);
doReturn(streamFile(StreamType.BALANCE, lastFileInstant)).when(accountBalanceFileRepository).findLatest();
doReturn(streamFile(StreamType.EVENT, lastFileInstant)).when(eventFileRepository).findLatest();
doReturn(streamFile(StreamType.RECORD, lastFileInstant)).when(recordFileRepository).findLatest();
Instant startDate = lastFileInstant.plusNanos(diffNanos);
mirrorProperties.setStartDate(startDate);
Instant effectiveStartDate = max(startDate, lastFileInstant);
DateRangeFilter expectedFilter = new DateRangeFilter(startDate, null);
for (var downloaderProperties : downloaderPropertiesList) {
StreamType streamType = downloaderProperties.getStreamType();
Optional<StreamFile> streamFile = streamFile(streamType, effectiveStartDate);
assertThat(mirrorDateRangePropertiesProcessor.getLastStreamFile(streamType)).isEqualTo(streamFile);
assertThat(mirrorDateRangePropertiesProcessor.getDateRangeFilter(downloaderProperties.getStreamType())).isEqualTo(expectedFilter);
}
}
use of com.hedera.mirror.common.domain.StreamType in project hedera-mirror-node by hashgraph.
the class MirrorDateRangePropertiesProcessorTest method notSetAndDatabaseEmpty.
@Test
void notSetAndDatabaseEmpty() {
Instant expectedDate = STARTUP_TIME;
DateRangeFilter expectedFilter = new DateRangeFilter(expectedDate, null);
for (var downloaderProperties : downloaderPropertiesList) {
StreamType streamType = downloaderProperties.getStreamType();
assertThat(mirrorDateRangePropertiesProcessor.getLastStreamFile(streamType)).isEqualTo(streamFile(streamType, expectedDate));
assertThat(mirrorDateRangePropertiesProcessor.getDateRangeFilter(streamType)).isEqualTo(expectedFilter);
}
assertThat(mirrorProperties.getVerifyHashAfter()).isEqualTo(expectedDate);
}
Aggregations