use of com.hedera.mirror.grpc.domain.TopicMessageFilter in project hedera-mirror-node by hashgraph.
the class TopicMessageServiceTest method missingMessagesFromListenerSomeRetrieved.
@Test
void missingMessagesFromListenerSomeRetrieved() {
TopicMessageFilter filter = TopicMessageFilter.builder().startTime(Instant.EPOCH).topicId(topicId).build();
missingMessagesFromListenerTest(filter, Flux.just(topicMessage(5), topicMessage(6)));
topicMessageService.subscribeTopic(filter).map(TopicMessage::getSequenceNumber).as(StepVerifier::create).expectNext(1L, 2L, 3L, 4L, 5L, 6L).expectError(IllegalStateException.class).verify(Duration.ofMillis(700));
}
use of com.hedera.mirror.grpc.domain.TopicMessageFilter in project hedera-mirror-node by hashgraph.
the class TopicMessageServiceTest method startTimeAfterNow.
@Test
void startTimeAfterNow() {
TopicMessageFilter filter = TopicMessageFilter.builder().startTime(Instant.now().plusSeconds(10L)).topicId(topicId).build();
assertThatThrownBy(() -> topicMessageService.subscribeTopic(filter)).isInstanceOf(ConstraintViolationException.class).hasMessageContaining("Start time must be before the current time");
}
use of com.hedera.mirror.grpc.domain.TopicMessageFilter in project hedera-mirror-node by hashgraph.
the class TopicMessageServiceTest method bothMessages.
@Test
void bothMessages() {
domainBuilder.topicMessages(3, now).blockLast();
TopicMessageFilter filter = TopicMessageFilter.builder().limit(5).startTime(Instant.EPOCH).topicId(topicId).build();
topicMessageService.subscribeTopic(filter).map(TopicMessage::getSequenceNumber).as(StepVerifier::create).thenAwait(Duration.ofMillis(100)).then(() -> domainBuilder.topicMessages(3, future).blockLast()).expectNext(1L, 2L, 3L, 4L, 5L).expectComplete().verify(Duration.ofMillis(500));
}
use of com.hedera.mirror.grpc.domain.TopicMessageFilter in project hedera-mirror-node by hashgraph.
the class TopicMessageServiceTest method noMessagesWithPastEndTime.
@Test
void noMessagesWithPastEndTime() {
TopicMessageFilter filter = TopicMessageFilter.builder().startTime(Instant.EPOCH).endTime(Instant.EPOCH.plusSeconds(1)).topicId(topicId).build();
topicMessageService.subscribeTopic(filter).as(StepVerifier::create).expectNextCount(0L).expectComplete().verify(Duration.ofMillis(500));
}
use of com.hedera.mirror.grpc.domain.TopicMessageFilter in project hedera-mirror-node by hashgraph.
the class TopicMessageServiceTest method invalidTopic.
@Test
void invalidTopic() {
domainBuilder.entity(e -> e.type(EntityType.ACCOUNT).num(100L).id(100L)).block();
TopicMessageFilter filter = TopicMessageFilter.builder().topicId(topicId).build();
topicMessageService.subscribeTopic(filter).as(StepVerifier::create).expectError(IllegalArgumentException.class).verify(Duration.ofMillis(100));
}
Aggregations