Skip to content

Commit

Permalink
Fixed checkstyle (#1819)
Browse files Browse the repository at this point in the history
  • Loading branch information
szczygiel-m authored Jan 23, 2024
1 parent 09965b1 commit 982411c
Show file tree
Hide file tree
Showing 21 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
-->
<module name="LineLength">
<property name="fileExtensions" value="java"/>
<property name="max" value="140"/>
<property name="max" value="400"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@
import pl.allegro.tech.hermes.api.Subscription;
import pl.allegro.tech.hermes.api.Topic;
import pl.allegro.tech.hermes.domain.group.GroupNotEmptyException;
import pl.allegro.tech.hermes.test.helper.client.integration.HermesInitHelper;
import pl.allegro.tech.hermes.test.helper.client.integration.HermesTestClient;
import pl.allegro.tech.hermes.env.BrokerOperations;
import pl.allegro.tech.hermes.integrationtests.prometheus.PrometheusExtension;
import pl.allegro.tech.hermes.integrationtests.subscriber.TestSubscriber;
import pl.allegro.tech.hermes.integrationtests.subscriber.TestSubscribersExtension;
import pl.allegro.tech.hermes.management.domain.auth.RequestUser;
import pl.allegro.tech.hermes.management.domain.group.GroupService;
import pl.allegro.tech.hermes.management.domain.subscription.SubscriptionService;
import pl.allegro.tech.hermes.management.domain.topic.TopicService;
import pl.allegro.tech.hermes.integrationtests.prometheus.PrometheusExtension;
import pl.allegro.tech.hermes.test.helper.client.integration.HermesInitHelper;
import pl.allegro.tech.hermes.test.helper.client.integration.HermesTestClient;
import pl.allegro.tech.hermes.test.helper.containers.ConfluentSchemaRegistryContainer;
import pl.allegro.tech.hermes.test.helper.containers.KafkaContainerCluster;
import pl.allegro.tech.hermes.test.helper.containers.ZookeeperContainer;
import pl.allegro.tech.hermes.env.BrokerOperations;

import java.util.List;
import java.util.stream.Stream;

import static pl.allegro.tech.hermes.integrationtests.setup.HermesManagementTestApp.AUDIT_EVENT_PATH;
import static com.jayway.awaitility.Awaitility.waitAtMost;
import static pl.allegro.tech.hermes.integrationtests.setup.HermesManagementTestApp.AUDIT_EVENT_PATH;
import static pl.allegro.tech.hermes.test.helper.endpoint.TimeoutAdjuster.adjust;

public class HermesExtension implements BeforeAllCallback, AfterAllCallback, ExtensionContext.Store.CloseableResource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
import org.hornetq.api.jms.JMSFactoryType;
import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;

import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.jms.ConnectionFactory;
import javax.jms.JMSContext;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Topic;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import static com.jayway.awaitility.Awaitility.await;
import static java.util.concurrent.TimeUnit.SECONDS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import com.github.tomakehurst.wiremock.verification.LoggedRequest;
import com.jayway.awaitility.Duration;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import pl.allegro.tech.hermes.api.BatchSubscriptionPolicy;
import pl.allegro.tech.hermes.api.ContentType;
import pl.allegro.tech.hermes.api.Subscription;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import org.junit.jupiter.api.extension.RegisterExtension;
import org.springframework.http.HttpHeaders;
import pl.allegro.tech.hermes.api.Topic;
import pl.allegro.tech.hermes.integrationtests.setup.TraceContext;
import pl.allegro.tech.hermes.integrationtests.subscriber.TestJmsSubscriber;
import pl.allegro.tech.hermes.integrationtests.setup.HermesExtension;
import pl.allegro.tech.hermes.integrationtests.setup.JmsStarter;
import pl.allegro.tech.hermes.integrationtests.setup.TraceContext;
import pl.allegro.tech.hermes.integrationtests.subscriber.TestJmsSubscriber;
import pl.allegro.tech.hermes.test.helper.message.TestMessage;

import java.util.UUID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ public class KafkaRetransmissionServiceTest {
@Test
public void shouldMoveOffsetNearGivenTimestamp() throws InterruptedException {
// given
TestSubscriber subscriber = subscribers.createSubscriber();
Topic topic = hermes.initHelper().createTopic(topicWithRandomName().build());
Subscription subscription = hermes.initHelper().createSubscription(subscriptionWithRandomName(topic.getName(), subscriber.getEndpoint()).build());
final TestSubscriber subscriber = subscribers.createSubscriber();
final Topic topic = hermes.initHelper().createTopic(topicWithRandomName().build());
final Subscription subscription = hermes.initHelper().createSubscription(subscriptionWithRandomName(topic.getName(), subscriber.getEndpoint()).build());
publishAndConsumeMessages(messages, topic, subscriber);
Thread.sleep(1000); //wait 1s because our date time format has seconds precision
final OffsetRetransmissionDate retransmissionDate = new OffsetRetransmissionDate(OffsetDateTime.now());
Expand All @@ -83,7 +83,7 @@ public void shouldMoveOffsetInDryRunMode() throws InterruptedException {
// given
TestSubscriber subscriber = subscribers.createSubscriber();
Topic topic = hermes.initHelper().createTopic(topicWithRandomName().build());
Subscription subscription = hermes.initHelper().createSubscription(subscriptionWithRandomName(topic.getName(), subscriber.getEndpoint()).build());
final Subscription subscription = hermes.initHelper().createSubscription(subscriptionWithRandomName(topic.getName(), subscriber.getEndpoint()).build());
// we have 2 partitions, thus 4 messages to get 2 per partition
publishAndConsumeMessages(messages, topic, subscriber);
Thread.sleep(2000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void shouldFetchSingleAvroMessageWithSchemaAwareSerialization() {
@Test
public void shouldReturnNotFoundErrorForNonExistingOffset() {
// given
long nonExistingOffset = 10L;
final long nonExistingOffset = 10L;
TestSubscriber subscriber = subscribers.createSubscriber();
Topic topic = hermes.initHelper().createTopic(topicWithRandomName().build());
hermes.initHelper().createSubscription(subscriptionWithRandomName(topic.getName(), subscriber.getEndpoint()).build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public void shouldReportMetricForFilteredSubscription() {
// given
TestSubscriber subscriber = subscribers.createSubscriber();
Topic topic = hermes.initHelper().createTopic(topicWithRandomName().build());
Subscription subscription = hermes.initHelper().createSubscription(
final Subscription subscription = hermes.initHelper().createSubscription(
subscription(topic, "subscription")
.withEndpoint(subscriber.getEndpoint())
.withSubscriptionPolicy(
Expand Down Expand Up @@ -260,7 +260,7 @@ public void shouldReportMetricsForSuccessfulBatchDelivery() {
// given
TestSubscriber subscriber = subscribers.createSubscriber();
Topic topic = hermes.initHelper().createTopic(topicWithRandomName().build());
Subscription subscription = hermes.initHelper().createSubscription(
final Subscription subscription = hermes.initHelper().createSubscription(
subscription(topic, "subscription")
.withEndpoint(subscriber.getEndpoint())
.withSubscriptionPolicy(
Expand Down Expand Up @@ -320,7 +320,7 @@ public void shouldReportMetricsForFailedBatchDelivery() {
// given
TestSubscriber subscriber = subscribers.createSubscriber(404);
Topic topic = hermes.initHelper().createTopic(topicWithRandomName().build());
Subscription subscription = hermes.initHelper().createSubscription(
final Subscription subscription = hermes.initHelper().createSubscription(
subscription(topic, "subscription")
.withEndpoint(subscriber.getEndpoint())
.withSubscriptionPolicy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import pl.allegro.tech.hermes.api.Topic;
import pl.allegro.tech.hermes.api.TopicName;
import pl.allegro.tech.hermes.integrationtests.helpers.TraceHeaders;
import pl.allegro.tech.hermes.integrationtests.setup.HermesExtension;
import pl.allegro.tech.hermes.integrationtests.metadata.TraceContext;
import pl.allegro.tech.hermes.integrationtests.setup.HermesExtension;
import pl.allegro.tech.hermes.integrationtests.subscriber.TestSubscriber;
import pl.allegro.tech.hermes.integrationtests.subscriber.TestSubscribersExtension;
import pl.allegro.tech.hermes.test.helper.builder.SubscriptionBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,8 @@ public void shouldPublishAndConsumeJsonMessageAfterMigrationFromJsonToAvro() {
hermes.initHelper().createSubscription(subscription(topic.getQualifiedName(),
"subscription", subscriber.getEndpoint()).build());

TestMessage beforeMigrationMessage = new AvroUser("Bob", 50, "blue").asTestMessage();
AvroUser afterMigrationMessage = new AvroUser("Barney", 35, "yellow");
final TestMessage beforeMigrationMessage = new AvroUser("Bob", 50, "blue").asTestMessage();
final AvroUser afterMigrationMessage = new AvroUser("Barney", 35, "yellow");

hermes.api().publishUntilSuccess(topic.getQualifiedName(), beforeMigrationMessage.body());
subscriber.waitUntilReceived(beforeMigrationMessage.body());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void shouldRespectReadinessStatusSetByAdmin() {
hermes.api().setReadiness(DEFAULT_DC_NAME, false).expectStatus().isAccepted();

// then
waitAtMost(Duration.FIVE_SECONDS).until(
waitAtMost(Duration.FIVE_SECONDS).until(
() -> Objects.equals(hermes.api().getReadiness().expectStatus().is5xxServerError().expectBody(String.class).returnResult().getResponseBody(), "NOT_READY")
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package pl.allegro.tech.hermes.integrationtests;

import org.junit.jupiter.api.Test;
import com.jayway.awaitility.Duration;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import pl.allegro.tech.hermes.api.Subscription;
import pl.allegro.tech.hermes.api.Topic;
Expand Down Expand Up @@ -29,7 +29,7 @@ public void shouldLogUndeliveredMessage() {
hermes.api().publishUntilSuccess(topic.getQualifiedName(), TestMessage.simple().body());

// then
waitAtMost(Duration.TEN_SECONDS).until( () ->
waitAtMost(Duration.TEN_SECONDS).until(() ->
hermes.api().getLatestUndeliveredMessage(topic.getQualifiedName(), subscription.getName()).expectStatus().is2xxSuccessful()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,11 @@ public void shouldQuerySubscriptionsMetrics() {
subscriptionWithRandomName(topic2.getName(), "http://endpoint2").build()
);

String queryGetAllSubscriptionsMetrics = "{\"query\": {}}";
String queryGetSubscriptionsMetricsWithPositiveThroughput = "{\"query\": {\"throughput\": {\"gt\": 0}}}";
String queryGetSubscriptionsMetricsWithRateInRange = "{\"query\": {\"or\": [{\"rate\": {\"gt\": 10}}, {\"rate\": {\"lt\": 50}}]}}";
String queryGetSubscriptionsMetricsWithLagNegative = "{\"query\": {\"lag\": {\"lt\": 0}}}";
String queryGetSubscriptionsMetricsWithVolume = "{\"query\": {\"volume\": {\"gt\": -1}}}";
final String queryGetAllSubscriptionsMetrics = "{\"query\": {}}";
final String queryGetSubscriptionsMetricsWithPositiveThroughput = "{\"query\": {\"throughput\": {\"gt\": 0}}}";
final String queryGetSubscriptionsMetricsWithRateInRange = "{\"query\": {\"or\": [{\"rate\": {\"gt\": 10}}, {\"rate\": {\"lt\": 50}}]}}";
final String queryGetSubscriptionsMetricsWithLagNegative = "{\"query\": {\"lag\": {\"lt\": 0}}}";
final String queryGetSubscriptionsMetricsWithVolume = "{\"query\": {\"volume\": {\"gt\": -1}}}";
prometheus.stubSubscriptionMetrics(
subscriptionMetrics(subscription1.getQualifiedName())
.withRate(100)
Expand All @@ -282,23 +282,23 @@ public void shouldQuerySubscriptionsMetrics() {

waitAtMost(adjust(Duration.ONE_MINUTE)).until(() -> {
// when
List<SubscriptionNameWithMetrics> allSubscriptions = hermes.api()
final List<SubscriptionNameWithMetrics> allSubscriptions = hermes.api()
.querySubscriptionMetrics(queryGetAllSubscriptionsMetrics)
.expectStatus().isOk()
.expectBodyList(SubscriptionNameWithMetrics.class).returnResult().getResponseBody();
List<SubscriptionNameWithMetrics> subscriptionsWithPositiveThroughput = hermes.api()
final List<SubscriptionNameWithMetrics> subscriptionsWithPositiveThroughput = hermes.api()
.querySubscriptionMetrics(queryGetSubscriptionsMetricsWithPositiveThroughput)
.expectStatus().isOk()
.expectBodyList(SubscriptionNameWithMetrics.class).returnResult().getResponseBody();
List<SubscriptionNameWithMetrics> subscriptionsWithRateInRange = hermes.api()
final List<SubscriptionNameWithMetrics> subscriptionsWithRateInRange = hermes.api()
.querySubscriptionMetrics(queryGetSubscriptionsMetricsWithRateInRange)
.expectStatus().isOk()
.expectBodyList(SubscriptionNameWithMetrics.class).returnResult().getResponseBody();
List<SubscriptionNameWithMetrics> subscriptionsWithNegativeLag = hermes.api()
final List<SubscriptionNameWithMetrics> subscriptionsWithNegativeLag = hermes.api()
.querySubscriptionMetrics(queryGetSubscriptionsMetricsWithLagNegative)
.expectStatus().isOk()
.expectBodyList(SubscriptionNameWithMetrics.class).returnResult().getResponseBody();
List<SubscriptionNameWithMetrics> subscriptionsWithVolume = hermes.api()
final List<SubscriptionNameWithMetrics> subscriptionsWithVolume = hermes.api()
.querySubscriptionMetrics(queryGetSubscriptionsMetricsWithVolume)
.expectStatus().isOk()
.expectBodyList(SubscriptionNameWithMetrics.class).returnResult().getResponseBody();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void shouldCreateTopic() {
public void shouldListTopics() {
// given
hermes.initHelper().createTopic(topic("listTopicsGroup.topic1").build());
hermes.api().createTopic( new TopicWithSchema(topic("listTopicsGroup.topic2").build(), null));
hermes.api().createTopic(new TopicWithSchema(topic("listTopicsGroup.topic2").build(), null));

// when then
assertThat(getGroupTopicsList("listTopicsGroup")).containsExactly("listTopicsGroup.topic1", "listTopicsGroup.topic2");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import org.junit.jupiter.api.extension.RegisterExtension;
import org.springframework.test.web.reactive.server.WebTestClient;
import pl.allegro.tech.hermes.api.Topic;
import pl.allegro.tech.hermes.test.helper.client.integration.FrontendTestClient;
import pl.allegro.tech.hermes.integrationtests.setup.HermesFrontendTestApp;
import pl.allegro.tech.hermes.integrationtests.setup.HermesManagementExtension;
import pl.allegro.tech.hermes.integrationtests.setup.InfrastructureExtension;
import pl.allegro.tech.hermes.test.helper.client.integration.FrontendTestClient;
import pl.allegro.tech.hermes.test.helper.message.TestMessage;

import java.util.function.Consumer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import org.springframework.http.HttpStatus;
import org.springframework.test.web.reactive.server.WebTestClient;
import pl.allegro.tech.hermes.frontend.server.HermesServer;
import pl.allegro.tech.hermes.test.helper.client.integration.FrontendTestClient;
import pl.allegro.tech.hermes.integrationtests.setup.HermesFrontendTestApp;
import pl.allegro.tech.hermes.integrationtests.setup.InfrastructureExtension;
import pl.allegro.tech.hermes.test.helper.client.integration.FrontendTestClient;
import pl.allegro.tech.hermes.test.helper.message.TestMessage;

import java.util.concurrent.TimeUnit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import org.springframework.test.web.reactive.server.WebTestClient;
import org.testcontainers.lifecycle.Startable;
import pl.allegro.tech.hermes.api.Topic;
import pl.allegro.tech.hermes.test.helper.client.integration.FrontendTestClient;
import pl.allegro.tech.hermes.integrationtests.setup.HermesFrontendTestApp;
import pl.allegro.tech.hermes.test.helper.client.integration.HermesInitHelper;
import pl.allegro.tech.hermes.integrationtests.setup.HermesManagementTestApp;
import pl.allegro.tech.hermes.integrationtests.setup.HermesTestApp;
import pl.allegro.tech.hermes.test.helper.client.integration.FrontendTestClient;
import pl.allegro.tech.hermes.test.helper.client.integration.HermesInitHelper;
import pl.allegro.tech.hermes.test.helper.containers.BrokerId;
import pl.allegro.tech.hermes.test.helper.containers.ConfluentSchemaRegistryContainer;
import pl.allegro.tech.hermes.test.helper.containers.KafkaContainerCluster;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
import pl.allegro.tech.hermes.frontend.buffer.chronicle.ChronicleMapMessageRepository;
import pl.allegro.tech.hermes.frontend.publishing.message.JsonMessage;
import pl.allegro.tech.hermes.frontend.publishing.message.MessageIdGenerator;
import pl.allegro.tech.hermes.test.helper.client.integration.FrontendTestClient;
import pl.allegro.tech.hermes.integrationtests.setup.HermesConsumersTestApp;
import pl.allegro.tech.hermes.integrationtests.setup.HermesFrontendTestApp;
import pl.allegro.tech.hermes.integrationtests.setup.HermesManagementExtension;
import pl.allegro.tech.hermes.integrationtests.setup.InfrastructureExtension;
import pl.allegro.tech.hermes.integrationtests.subscriber.TestSubscriber;
import pl.allegro.tech.hermes.integrationtests.subscriber.TestSubscribersExtension;
import pl.allegro.tech.hermes.test.helper.client.integration.FrontendTestClient;

import java.io.File;
import java.time.Clock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
import org.junit.jupiter.api.extension.RegisterExtension;
import org.testcontainers.lifecycle.Startable;
import pl.allegro.tech.hermes.api.Topic;
import pl.allegro.tech.hermes.test.helper.client.integration.FrontendTestClient;
import pl.allegro.tech.hermes.integrationtests.setup.HermesConsumersTestApp;
import pl.allegro.tech.hermes.integrationtests.setup.HermesFrontendTestApp;
import pl.allegro.tech.hermes.test.helper.client.integration.HermesInitHelper;
import pl.allegro.tech.hermes.integrationtests.setup.HermesManagementTestApp;
import pl.allegro.tech.hermes.integrationtests.setup.HermesTestApp;
import pl.allegro.tech.hermes.integrationtests.subscriber.TestSubscriber;
import pl.allegro.tech.hermes.integrationtests.subscriber.TestSubscribersExtension;
import pl.allegro.tech.hermes.test.helper.client.integration.FrontendTestClient;
import pl.allegro.tech.hermes.test.helper.client.integration.HermesInitHelper;
import pl.allegro.tech.hermes.test.helper.containers.ConfluentSchemaRegistryContainer;
import pl.allegro.tech.hermes.test.helper.containers.KafkaContainerCluster;
import pl.allegro.tech.hermes.test.helper.containers.ZookeeperContainer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
import pl.allegro.tech.hermes.api.ErrorDescription;
import pl.allegro.tech.hermes.api.Topic;
import pl.allegro.tech.hermes.api.TopicWithSchema;
import pl.allegro.tech.hermes.test.helper.client.integration.FrontendTestClient;
import pl.allegro.tech.hermes.integrationtests.setup.HermesFrontendTestApp;
import pl.allegro.tech.hermes.integrationtests.setup.HermesManagementExtension;
import pl.allegro.tech.hermes.integrationtests.setup.InfrastructureExtension;
import pl.allegro.tech.hermes.test.helper.avro.AvroUser;
import pl.allegro.tech.hermes.test.helper.avro.AvroUserSchemaLoader;
import pl.allegro.tech.hermes.test.helper.client.integration.FrontendTestClient;

import static pl.allegro.tech.hermes.api.ContentType.AVRO;
import static pl.allegro.tech.hermes.api.ErrorCode.SCHEMA_COULD_NOT_BE_LOADED;
Expand Down
Loading

0 comments on commit 982411c

Please sign in to comment.