use of com.hedera.mirror.api.proto.ConsensusTopicQuery in project hedera-mirror-node by hashgraph.
the class ConsensusControllerTest method subscribeTopicQueryLongOverflowEndTime.
@Test
void subscribeTopicQueryLongOverflowEndTime() {
TopicMessage topicMessage1 = domainBuilder.topicMessage().block();
TopicMessage topicMessage2 = domainBuilder.topicMessage().block();
TopicMessage topicMessage3 = domainBuilder.topicMessage().block();
ConsensusTopicQuery query = ConsensusTopicQuery.newBuilder().setLimit(5L).setConsensusStartTime(Timestamp.newBuilder().setSeconds(1).setNanos(2).build()).setConsensusEndTime(Timestamp.newBuilder().setSeconds(31556889864403199L).setNanos(999999999).build()).setTopicID(TopicID.newBuilder().setRealmNum(0).setTopicNum(100).build()).build();
Flux<TopicMessage> generator = domainBuilder.topicMessages(2, Instant.now().plusSeconds(10L));
grpcConsensusService.subscribeTopic(Mono.just(query)).as(StepVerifier::create).expectNext(topicMessage1.getResponse()).expectNext(topicMessage2.getResponse()).expectNext(topicMessage3.getResponse()).thenAwait(Duration.ofMillis(50)).then(() -> generator.blockLast()).expectNextCount(2).expectComplete().verify(Duration.ofMillis(500));
}
use of com.hedera.mirror.api.proto.ConsensusTopicQuery in project hedera-mirror-node by hashgraph.
the class ConsensusControllerTest method subscribeVerifySequence.
@Test
void subscribeVerifySequence() {
domainBuilder.topicMessage().block();
domainBuilder.topicMessage().block();
domainBuilder.topicMessage().block();
ConsensusTopicQuery query = ConsensusTopicQuery.newBuilder().setLimit(7L).setConsensusStartTime(Timestamp.newBuilder().setSeconds(0).build()).setTopicID(TopicID.newBuilder().setRealmNum(0).setTopicNum(100).build()).build();
Flux<TopicMessage> generator = domainBuilder.topicMessages(4, Instant.now().plusSeconds(10L));
grpcConsensusService.subscribeTopic(Mono.just(query)).map(ConsensusTopicResponse::getSequenceNumber).as(StepVerifier::create).expectNext(1L, 2L, 3L).thenAwait(Duration.ofMillis(50)).then(() -> generator.blockLast()).expectNext(4L, 5L, 6L, 7L).expectComplete().verify(Duration.ofMillis(1000));
}
use of com.hedera.mirror.api.proto.ConsensusTopicQuery in project hedera-mirror-node by hashgraph.
the class ConsensusControllerTest method subscribeTopicReactive.
@Test
void subscribeTopicReactive() {
TopicMessage topicMessage1 = domainBuilder.topicMessage().block();
TopicMessage topicMessage2 = domainBuilder.topicMessage().block();
TopicMessage topicMessage3 = domainBuilder.topicMessage().block();
ConsensusTopicQuery query = ConsensusTopicQuery.newBuilder().setLimit(5L).setConsensusStartTime(Timestamp.newBuilder().setSeconds(0).build()).setTopicID(TopicID.newBuilder().setRealmNum(0).setTopicNum(100).build()).build();
Flux<TopicMessage> generator = domainBuilder.topicMessages(2, Instant.now().plusSeconds(10L));
grpcConsensusService.subscribeTopic(Mono.just(query)).as(StepVerifier::create).expectNext(topicMessage1.getResponse()).expectNext(topicMessage2.getResponse()).expectNext(topicMessage3.getResponse()).thenAwait(Duration.ofMillis(50)).then(() -> generator.blockLast()).expectNextCount(2).expectComplete().verify(Duration.ofMillis(500));
}
use of com.hedera.mirror.api.proto.ConsensusTopicQuery in project hedera-mirror-node by hashgraph.
the class ConsensusControllerTest method constraintViolationException.
@Test
void constraintViolationException() {
ConsensusTopicQuery query = ConsensusTopicQuery.newBuilder().setTopicID(TopicID.newBuilder().build()).setLimit(-1).build();
grpcConsensusService.subscribeTopic(Mono.just(query)).as(StepVerifier::create).expectErrorSatisfies(t -> assertException(t, Status.Code.INVALID_ARGUMENT, "limit: must be greater " + "than or equal to 0")).verify(Duration.ofMillis(500));
}
use of com.hedera.mirror.api.proto.ConsensusTopicQuery in project hedera-mirror-node by hashgraph.
the class ConsensusControllerTest method subscribeTopicQueryPreEpochStartTime.
@Test
void subscribeTopicQueryPreEpochStartTime() {
TopicMessage topicMessage1 = domainBuilder.topicMessage().block();
TopicMessage topicMessage2 = domainBuilder.topicMessage().block();
TopicMessage topicMessage3 = domainBuilder.topicMessage().block();
ConsensusTopicQuery query = ConsensusTopicQuery.newBuilder().setLimit(5L).setConsensusStartTime(Timestamp.newBuilder().setSeconds(-123).setNanos(-456).build()).setTopicID(TopicID.newBuilder().setRealmNum(0).setTopicNum(100).build()).build();
Flux<TopicMessage> generator = domainBuilder.topicMessages(2, Instant.now().plusSeconds(10L));
grpcConsensusService.subscribeTopic(Mono.just(query)).as(StepVerifier::create).expectNext(topicMessage1.getResponse()).expectNext(topicMessage2.getResponse()).expectNext(topicMessage3.getResponse()).thenAwait(Duration.ofMillis(50)).then(() -> generator.blockLast()).expectNextCount(2).expectComplete().verify(Duration.ofMillis(500));
}
Aggregations