use of com.hedera.mirror.grpc.domain.TopicMessage in project hedera-mirror-node by hashgraph.
the class TopicMessageRepositoryTest method findByFilterWithEndTime.
@Test
void findByFilterWithEndTime() {
TopicMessage topicMessage1 = domainBuilder.topicMessage().block();
TopicMessage topicMessage2 = domainBuilder.topicMessage().block();
TopicMessage topicMessage3 = domainBuilder.topicMessage().block();
TopicMessageFilter filter = TopicMessageFilter.builder().startTime(topicMessage1.getConsensusTimestampInstant()).endTime(topicMessage3.getConsensusTimestampInstant()).topicId(EntityId.of(topicMessage1.getTopicId(), EntityType.TOPIC)).build();
assertThat(topicMessageRepository.findByFilter(filter)).containsExactly(topicMessage1, topicMessage2);
}
use of com.hedera.mirror.grpc.domain.TopicMessage in project hedera-mirror-node by hashgraph.
the class PollingTopicMessageRetrieverTest method notEnabled.
@ParameterizedTest
@ValueSource(booleans = { true, false })
void notEnabled(boolean throttled) {
retrieverProperties.setEnabled(false);
domainBuilder.topicMessage().block();
TopicMessageFilter filter = TopicMessageFilter.builder().startTime(Instant.EPOCH).topicId(TOPIC_ID).build();
pollingTopicMessageRetriever.retrieve(filter, throttled).map(TopicMessage::getSequenceNumber).as(StepVerifier::create).expectNextCount(0L).expectComplete().verify(Duration.ofMillis(500));
retrieverProperties.setEnabled(true);
}
use of com.hedera.mirror.grpc.domain.TopicMessage in project hedera-mirror-node by hashgraph.
the class PollingTopicMessageRetrieverTest method lessThanPageSize.
@ParameterizedTest
@ValueSource(booleans = { true, false })
void lessThanPageSize(boolean throttle) {
domainBuilder.topicMessage().block();
TopicMessageFilter filter = TopicMessageFilter.builder().startTime(Instant.EPOCH).topicId(TOPIC_ID).build();
pollingTopicMessageRetriever.retrieve(filter, throttle).map(TopicMessage::getSequenceNumber).as(StepVerifier::create).expectNext(1L).expectComplete().verify(Duration.ofMillis(500));
}
use of com.hedera.mirror.grpc.domain.TopicMessage in project hedera-mirror-node by hashgraph.
the class PollingTopicMessageRetrieverTest method equalPageSize.
@ParameterizedTest
@ValueSource(booleans = { true, false })
void equalPageSize(boolean throttle) {
int maxPageSize = overrideMaxPageSize(throttle, 2);
domainBuilder.topicMessage().block();
domainBuilder.topicMessage().block();
TopicMessageFilter filter = TopicMessageFilter.builder().startTime(Instant.EPOCH).topicId(TOPIC_ID).build();
pollingTopicMessageRetriever.retrieve(filter, throttle).map(TopicMessage::getSequenceNumber).as(StepVerifier::create).expectNext(1L, 2L).expectComplete().verify(Duration.ofMillis(500));
restoreMaxPageSize(throttle, maxPageSize);
}
use of com.hedera.mirror.grpc.domain.TopicMessage in project hedera-mirror-node by hashgraph.
the class PollingTopicMessageRetrieverTest method topicId.
@ParameterizedTest
@ValueSource(booleans = { true, false })
void topicId(boolean throttle) {
domainBuilder.topicMessage(t -> t.topicId(0)).block();
domainBuilder.topicMessage(t -> t.topicId(1)).block();
domainBuilder.topicMessage(t -> t.topicId(2)).block();
TopicMessageFilter filter = TopicMessageFilter.builder().startTime(Instant.EPOCH).topicId(EntityId.of(1L, EntityType.TOPIC)).build();
pollingTopicMessageRetriever.retrieve(filter, throttle).map(TopicMessage::getSequenceNumber).as(StepVerifier::create).expectNext(2L).thenCancel().verify(Duration.ofMillis(500));
}
Aggregations