Search in sources :

Example 26 with TopicMessageFilter

use of com.hedera.mirror.grpc.domain.TopicMessageFilter in project hedera-mirror-node by hashgraph.

the class TopicMessageRepositoryTest method findByFilterEmpty.

@Test
void findByFilterEmpty() {
    TopicMessageFilter filter = TopicMessageFilter.builder().startTime(Instant.EPOCH).topicId(EntityId.of(100L, EntityType.TOPIC)).build();
    assertThat(topicMessageRepository.findByFilter(filter)).isEmpty();
}
Also used : TopicMessageFilter(com.hedera.mirror.grpc.domain.TopicMessageFilter) GrpcIntegrationTest(com.hedera.mirror.grpc.GrpcIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 27 with TopicMessageFilter

use of com.hedera.mirror.grpc.domain.TopicMessageFilter 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);
}
Also used : TopicMessage(com.hedera.mirror.grpc.domain.TopicMessage) TopicMessageFilter(com.hedera.mirror.grpc.domain.TopicMessageFilter) GrpcIntegrationTest(com.hedera.mirror.grpc.GrpcIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 28 with TopicMessageFilter

use of com.hedera.mirror.grpc.domain.TopicMessageFilter 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();
}
Also used : TopicMessage(com.hedera.mirror.grpc.domain.TopicMessage) TopicMessageFilter(com.hedera.mirror.grpc.domain.TopicMessageFilter) GrpcIntegrationTest(com.hedera.mirror.grpc.GrpcIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 29 with TopicMessageFilter

use of com.hedera.mirror.grpc.domain.TopicMessageFilter 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);
}
Also used : TopicMessage(com.hedera.mirror.grpc.domain.TopicMessage) TopicMessageFilter(com.hedera.mirror.grpc.domain.TopicMessageFilter) GrpcIntegrationTest(com.hedera.mirror.grpc.GrpcIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 30 with TopicMessageFilter

use of com.hedera.mirror.grpc.domain.TopicMessageFilter 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);
}
Also used : TopicMessage(com.hedera.mirror.grpc.domain.TopicMessage) TopicMessageFilter(com.hedera.mirror.grpc.domain.TopicMessageFilter) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

TopicMessageFilter (com.hedera.mirror.grpc.domain.TopicMessageFilter)62 TopicMessage (com.hedera.mirror.grpc.domain.TopicMessage)52 Test (org.junit.jupiter.api.Test)50 GrpcIntegrationTest (com.hedera.mirror.grpc.GrpcIntegrationTest)47 Instant (java.time.Instant)18 StepVerifier (reactor.test.StepVerifier)15 Duration (java.time.Duration)12 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)12 EntityId (com.hedera.mirror.common.domain.entity.EntityId)11 EntityType (com.hedera.mirror.common.domain.entity.EntityType)11 DomainBuilder (com.hedera.mirror.grpc.domain.DomainBuilder)11 Resource (javax.annotation.Resource)11 ValueSource (org.junit.jupiter.params.provider.ValueSource)11 Autowired (org.springframework.beans.factory.annotation.Autowired)11 Flux (reactor.core.publisher.Flux)11 AfterEach (org.junit.jupiter.api.AfterEach)10 BeforeEach (org.junit.jupiter.api.BeforeEach)10 ConstraintViolationException (javax.validation.ConstraintViolationException)9 GrpcProperties (com.hedera.mirror.grpc.GrpcProperties)6 EntityNotFoundException (com.hedera.mirror.grpc.exception.EntityNotFoundException)6