Add EmptyLineSeparator Checkstyle rule

* Support "blank lines around" via `spring-framework.xml` IDEA config
* Fix all the Checkstyle violations
This commit is contained in:
Artem Bilan
2024-03-27 16:54:25 -04:00
parent f71a2234d8
commit c155d5d418
932 changed files with 1341 additions and 2485 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -210,4 +210,5 @@ public interface RedisContainerTest {
redisTemplate.afterPropertiesSet();
return redisTemplate;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,6 +47,7 @@ import static org.mockito.Mockito.mock;
* @since 2.0
*/
class SubscribableRedisChannelTests implements RedisContainerTest {
private static RedisConnectionFactory redisConnectionFactory;
@BeforeAll

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -64,7 +64,6 @@ class RedisInboundChannelAdapterParserTests implements RedisContainerTest {
@Autowired
private Executor executor;
@Autowired
private RedisConnectionFactory redisConnectionFactory;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -130,7 +130,6 @@ class RedisOutboundChannelAdapterParserTests implements RedisContainerTest {
assertThat(message.getPayload()).isEqualTo("Hello Redis from chain");
}
@SuppressWarnings("unused")
private static class TestMessageConverter extends SimpleMessageConverter {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2022 the original author or authors.
* Copyright 2013-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,6 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Artem Bilan
* @author Gary Russell
@@ -83,11 +82,9 @@ public class RedisQueueInboundChannelAdapterParserTests {
@Qualifier("executor")
private TaskExecutor taskExecutor;
@Autowired
private RedisSerializer<?> serializer;
@Test
@SuppressWarnings("unchecked")
public void testInt3017DefaultConfig() {
@@ -109,7 +106,6 @@ public class RedisQueueInboundChannelAdapterParserTests {
assertThat(TestUtils.getPropertyValue(this.defaultAdapter, "rightPop", Boolean.class)).isTrue();
}
@Test
@SuppressWarnings("unchecked")
public void testInt3017CustomConfig() {
@@ -128,7 +124,6 @@ public class RedisQueueInboundChannelAdapterParserTests {
assertThat(TestUtils.getPropertyValue(this.customAdapter, "rightPop", Boolean.class)).isFalse();
}
@Test
public void testInt4341ZeroReceiveTimeoutConfig() {
assertThat(TestUtils.getPropertyValue(this.zeroReceiveTimeoutAdapter, "receiveTimeout")).isEqualTo(0L);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2023 the original author or authors.
* Copyright 2014-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
package org.springframework.integration.redis.config;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -30,7 +29,6 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author David Liu
* @author Artem Bilan
@@ -61,7 +59,6 @@ public class RedisQueueInboundGatewayParserTests {
@Autowired
private RedisSerializer<?> serializer;
@Test
public void testDefaultConfig() {
assertThat(TestUtils.getPropertyValue(this.defaultGateway, "extractPayload", Boolean.class)).isFalse();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2007-2022 the original author or authors.
* Copyright 2007-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,6 +42,7 @@ import static org.mockito.Mockito.mock;
* @since 2.1
*/
class RedisInboundChannelAdapterTests implements RedisContainerTest {
private static RedisConnectionFactory redisConnectionFactory;
@BeforeAll

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2022 the original author or authors.
* Copyright 2013-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -290,7 +290,6 @@ class RedisQueueMessageDrivenEndpointTests implements RedisContainerTest {
verify(boundListOperations, atLeastOnce()).rightPush(any(byte[].class));
}
@Test
@Disabled("LettuceConnectionFactory doesn't support proper reinitialization after 'destroy()'")
void testInt3196Recovery() throws Exception {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,6 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @since 2.2
*/
class RedisStoreInboundChannelAdapterIntegrationTests implements RedisContainerTest {
private static RedisConnectionFactory redisConnectionFactory;
@BeforeAll
@@ -197,7 +198,6 @@ class RedisStoreInboundChannelAdapterIntegrationTests implements RedisContainerT
zsetAdapterNoScore.stop();
//ScoreRange test
SourcePollingChannelAdapter zsetAdapterWithScoreRange =
context.getBean("zsetAdapterWithScoreRange", SourcePollingChannelAdapter.class);
@@ -214,7 +214,6 @@ class RedisStoreInboundChannelAdapterIntegrationTests implements RedisContainerT
zsetAdapterWithScoreRange.stop();
//SingleScore test
SourcePollingChannelAdapter zsetAdapterWithSingleScore =
context.getBean("zsetAdapterWithSingleScore", SourcePollingChannelAdapter.class);
@@ -231,7 +230,6 @@ class RedisStoreInboundChannelAdapterIntegrationTests implements RedisContainerT
zsetAdapterWithSingleScore.stop();
//SingleScoreAndSynchronization test
SourcePollingChannelAdapter zsetAdapterWithSingleScoreAndSynchronization =
context.getBean("zsetAdapterWithSingleScoreAndSynchronization", SourcePollingChannelAdapter.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 the original author or authors.
* Copyright 2016-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,6 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
@LogLevels(categories = "org.springframework.integration.redis.leader")
class RedisLockRegistryLeaderInitiatorTests implements RedisContainerTest {
private static RedisConnectionFactory redisConnectionFactory;
@BeforeAll

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2022 the original author or authors.
* Copyright 2013-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,6 +38,7 @@ import static org.assertj.core.api.Assertions.fail;
*
*/
class RedisMetadataStoreTests implements RedisContainerTest {
private static RedisConnectionFactory redisConnectionFactory;
@BeforeAll

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 the original author or authors.
* Copyright 2020-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -74,7 +74,6 @@ class ReactiveRedisStreamMessageHandlerTests implements RedisContainerTest {
template.delete(STREAM_KEY).block();
}
@Test
void testIntegrationStreamOutbound() {
String messagePayload = "Hello stream message";
@@ -108,7 +107,6 @@ class ReactiveRedisStreamMessageHandlerTests implements RedisContainerTest {
assertThat(record.getValue()).isEqualTo(messagePayload);
}
@Test
void testExplicitSerializationContextWithModel() {
Address address = new Address("Rennes, France");
@@ -147,7 +145,6 @@ class ReactiveRedisStreamMessageHandlerTests implements RedisContainerTest {
return directChannel;
}
@Bean
public ReactiveRedisStreamMessageHandler streamMessageHandler(ReactiveRedisConnectionFactory redisConnectionFactory) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2007-2022 the original author or authors.
* Copyright 2007-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,6 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @since 2.1
*/
class RedisPublishingMessageHandlerTests implements RedisContainerTest {
private static RedisConnectionFactory redisConnectionFactory;
@BeforeAll
@@ -82,7 +83,6 @@ class RedisPublishingMessageHandlerTests implements RedisContainerTest {
container.stop();
}
private static class Listener {
private final CountDownLatch latch;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2022 the original author or authors.
* Copyright 2013-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -62,7 +62,6 @@ class RedisQueueOutboundChannelAdapterTests implements RedisContainerTest {
@Qualifier("toRedisQueueChannel")
private MessageChannel sendChannel;
@Test
void testInt3015Default() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -538,6 +538,7 @@ class RedisStoreWritingMessageHandlerTests implements RedisContainerTest {
}
private static class President implements Serializable {
private static final long serialVersionUID = 1L;
private String name;
@@ -555,5 +556,7 @@ class RedisStoreWritingMessageHandlerTests implements RedisContainerTest {
public void setName(String name) {
this.name = name;
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2007-2023 the original author or authors.
* Copyright 2007-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -228,7 +228,6 @@ class RedisMessageGroupStoreTests implements RedisContainerTest {
.isThrownBy(() -> store.removeMessagesFromGroup(this.groupId, new GenericMessage<>("2")));
}
@Test
void testMultipleInstancesOfGroupStore() {
RedisMessageStore store1 = new RedisMessageStore(redisConnectionFactory);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2007-2022 the original author or authors.
* Copyright 2007-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,6 +50,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
*
*/
class RedisMessageStoreTests implements RedisContainerTest {
private static RedisConnectionFactory redisConnectionFactory;
@BeforeAll

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2020 the original author or authors.
* Copyright 2013-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@ package org.springframework.integration.redis.util;
import java.io.Serializable;
import java.util.Objects;
@SuppressWarnings("serial")
public class Person implements Serializable {
@@ -51,7 +50,6 @@ public class Person implements Serializable {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -404,7 +404,6 @@ class RedisLockRegistryTests implements RedisContainerTest {
registry.destroy();
}
@ParameterizedTest
@EnumSource(RedisLockType.class)
void testEquals(RedisLockType testRedisLockType) {
@@ -530,7 +529,6 @@ class RedisLockRegistryTests implements RedisContainerTest {
//capacity limit test
assertThat(getRedisLockRegistryLocks(registry)).hasSize(CAPACITY_CNT);
registry.expireUnusedOlderThan(-1000);
assertThat(getRedisLockRegistryLocks(registry)).isEmpty();
registry.destroy();
@@ -756,7 +754,6 @@ class RedisLockRegistryTests implements RedisContainerTest {
assertThat(atomicInteger.get()).isEqualTo(testCnt * lockRegistryNum);
}
@ParameterizedTest
@EnumSource(RedisLockType.class)
void earlyWakeUpTest(RedisLockType testRedisLockType) throws InterruptedException {