use of com.hedera.mirror.grpc.domain.TopicMessage in project hedera-mirror-node by hashgraph.
the class PollingTopicMessageRetrieverTest method startTimeBefore.
@ParameterizedTest
@ValueSource(booleans = { true, false })
void startTimeBefore(boolean throttle) {
domainBuilder.topicMessages(10, Instant.now()).blockLast();
TopicMessageFilter filter = TopicMessageFilter.builder().startTime(Instant.EPOCH).topicId(TOPIC_ID).build();
pollingTopicMessageRetriever.retrieve(filter, throttle).map(TopicMessage::getSequenceNumber).as(StepVerifier::create).expectNext(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L).thenCancel().verify(Duration.ofMillis(1000));
}
use of com.hedera.mirror.grpc.domain.TopicMessage in project hedera-mirror-node by hashgraph.
the class PollingTopicMessageRetrieverTest method noMessages.
@ParameterizedTest
@ValueSource(booleans = { true, false })
void noMessages(boolean throttled) {
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));
}
use of com.hedera.mirror.grpc.domain.TopicMessage in project hedera-mirror-node by hashgraph.
the class PollingTopicMessageRetrieverTest method greaterThanPageSize.
@ParameterizedTest
@ValueSource(booleans = { true, false })
void greaterThanPageSize(boolean throttle) {
int maxPageSize = overrideMaxPageSize(throttle, 2);
domainBuilder.topicMessage().block();
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, 3L).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 startTimeEquals.
@ParameterizedTest
@ValueSource(booleans = { true, false })
void startTimeEquals(boolean throttle) {
Instant now = Instant.now();
domainBuilder.topicMessage(t -> t.consensusTimestamp(now)).block();
TopicMessageFilter filter = TopicMessageFilter.builder().startTime(now).topicId(TOPIC_ID).build();
pollingTopicMessageRetriever.retrieve(filter, throttle).map(TopicMessage::getSequenceNumber).as(StepVerifier::create).expectNext(1L).thenCancel().verify(Duration.ofMillis(500));
}
use of com.hedera.mirror.grpc.domain.TopicMessage in project hedera-mirror-node by hashgraph.
the class ConsensusControllerTest method subscribeTopicBlocking.
@Test
void subscribeTopicBlocking() {
TopicMessage topicMessage1 = domainBuilder.topicMessage().block();
TopicMessage topicMessage2 = domainBuilder.topicMessage().block();
TopicMessage topicMessage3 = domainBuilder.topicMessage().block();
ConsensusTopicQuery query = ConsensusTopicQuery.newBuilder().setLimit(3L).setConsensusStartTime(Timestamp.newBuilder().setSeconds(0).build()).setTopicID(TopicID.newBuilder().setRealmNum(0).setTopicNum(100).build()).build();
assertThat(blockingService.subscribeTopic(query)).toIterable().hasSize(3).containsSequence(topicMessage1.getResponse(), topicMessage2.getResponse(), topicMessage3.getResponse());
}
Aggregations