use of com.hedera.mirror.grpc.domain.TopicMessage in project hedera-mirror-node by hashgraph.
the class AbstractTopicListenerTest method startTimeEquals.
@Test
void startTimeEquals() {
Mono<TopicMessage> topicMessage = domainBuilder.topicMessage(t -> t.consensusTimestamp(future));
TopicMessageFilter filter = TopicMessageFilter.builder().startTime(future).topicId(topicId).build();
topicListener.listen(filter).map(TopicMessage::getSequenceNumber).as(StepVerifier::create).thenAwait(Duration.ofMillis(50)).then(() -> publish(topicMessage)).expectNext(1L).thenCancel().verify(Duration.ofMillis(500));
}
use of com.hedera.mirror.grpc.domain.TopicMessage in project hedera-mirror-node by hashgraph.
the class AbstractTopicListenerTest method equalPageSize.
@Test
void equalPageSize() {
int maxPageSize = listenerProperties.getMaxPageSize();
listenerProperties.setMaxPageSize(2);
TopicMessageFilter filter = TopicMessageFilter.builder().startTime(Instant.EPOCH).topicId(topicId).build();
topicListener.listen(filter).map(TopicMessage::getSequenceNumber).as(StepVerifier::create).thenAwait(Duration.ofMillis(50)).then(() -> publish(domainBuilder.topicMessages(2, future))).expectNext(1L, 2L).thenCancel().verify(Duration.ofMillis(500));
listenerProperties.setMaxPageSize(maxPageSize);
}
use of com.hedera.mirror.grpc.domain.TopicMessage in project hedera-mirror-node by hashgraph.
the class AbstractTopicListenerTest method topicId.
@Test
void topicId() {
Flux<TopicMessage> generator = Flux.concat(domainBuilder.topicMessage(t -> t.topicId(0).consensusTimestamp(future.plusNanos(1L))), domainBuilder.topicMessage(t -> t.topicId(1).consensusTimestamp(future.plusNanos(2L))), domainBuilder.topicMessage(t -> t.topicId(2).consensusTimestamp(future.plusNanos(3L))));
TopicMessageFilter filter = TopicMessageFilter.builder().startTime(Instant.EPOCH).topicId(EntityId.of(1L, EntityType.TOPIC)).build();
topicListener.listen(filter).map(TopicMessage::getSequenceNumber).as(StepVerifier::create).thenAwait(Duration.ofMillis(50)).then(() -> publish(generator)).expectNext(2L).thenCancel().verify(Duration.ofMillis(500));
}
use of com.hedera.mirror.grpc.domain.TopicMessage in project hedera-mirror-node by hashgraph.
the class TopicMessageRepositoryTest method findByFilterWithLimit.
@Test
void findByFilterWithLimit() {
TopicMessage topicMessage1 = domainBuilder.topicMessage().block();
TopicMessage topicMessage2 = domainBuilder.topicMessage().block();
TopicMessage topicMessage3 = domainBuilder.topicMessage().block();
TopicMessageFilter filter = TopicMessageFilter.builder().limit(1).startTime(topicMessage1.getConsensusTimestampInstant()).topicId(EntityId.of(topicMessage1.getTopicId(), EntityType.TOPIC)).build();
assertThat(topicMessageRepository.findByFilter(filter)).containsExactly(topicMessage1);
}
use of com.hedera.mirror.grpc.domain.TopicMessage in project hedera-mirror-node by hashgraph.
the class TopicMessageRepositoryTest method findByFilterNoMatch.
@Test
void findByFilterNoMatch() {
TopicMessage topicMessage1 = domainBuilder.topicMessage().block();
TopicMessage topicMessage2 = domainBuilder.topicMessage().block();
TopicMessage topicMessage3 = domainBuilder.topicMessage().block();
TopicMessageFilter filter = TopicMessageFilter.builder().startTime(Instant.now().plusSeconds(10)).topicId(EntityId.of(topicMessage1.getTopicId(), EntityType.TOPIC)).build();
assertThat(topicMessageRepository.findByFilter(filter)).isEmpty();
}
Aggregations