From 0be26bf69fd539db63a15c8ce4c4191635bfb933 Mon Sep 17 00:00:00 2001 From: chickenchickenlove Date: Wed, 9 Oct 2024 00:34:55 +0900 Subject: [PATCH] Remove dead code from test codes. --- .../RetryTopicClassLevelIntegrationTests.java | 13 +------------ .../retrytopic/RetryTopicIntegrationTests.java | 13 +------------ 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicClassLevelIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicClassLevelIntegrationTests.java index 359f53cb1d..a1b93b1a5b 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicClassLevelIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicClassLevelIntegrationTests.java @@ -83,7 +83,6 @@ import org.springframework.retry.annotation.Backoff; import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; -import org.springframework.stereotype.Component; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; @@ -94,6 +93,7 @@ * * @author Wang Zhiyang * @author Artem Bilan + * @author Sanghyeok An * * @since 3.2 */ @@ -304,7 +304,6 @@ private boolean awaitLatch(CountDownLatch latch) { } } - @Component @KafkaListener(id = "firstTopicId", topics = FIRST_TOPIC, containerFactory = MAIN_TOPIC_CONTAINER_FACTORY, errorHandler = "myCustomErrorHandler", contentTypeConverter = "myCustomMessageConverter", concurrency = "2") @@ -324,7 +323,6 @@ public void listen(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) String r } - @Component @KafkaListener(topics = SECOND_TOPIC, containerFactory = MAIN_TOPIC_CONTAINER_FACTORY) static class SecondTopicListener { @@ -338,7 +336,6 @@ public void listenAgain(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) Str } } - @Component @RetryableTopic(attempts = "${five.attempts}", backoff = @Backoff(delay = 250, maxDelay = 1000, multiplier = 1.5), numPartitions = "#{3}", @@ -365,7 +362,6 @@ public void annotatedDltMethod(Object message) { } } - @Component @RetryableTopic(dltStrategy = DltStrategy.NO_DLT, attempts = "4", backoff = @Backoff(300), sameIntervalTopicReuseStrategy = SameIntervalTopicReuseStrategy.MULTIPLE_TOPICS, kafkaTemplate = "${kafka.template}") @@ -444,7 +440,6 @@ public void listenWithAnnotation2(String message, @Header(KafkaHeaders.RECEIVED_ } - @Component @RetryableTopic(attempts = "4", backoff = @Backoff(50), sameIntervalTopicReuseStrategy = SameIntervalTopicReuseStrategy.MULTIPLE_TOPICS) @KafkaListener(id = "manual", topics = MANUAL_TOPIC, containerFactory = MAIN_TOPIC_CONTAINER_FACTORY) @@ -463,7 +458,6 @@ public void listenNoDlt(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) Str } - @Component @RetryableTopic(attempts = "3", numPartitions = "3", exclude = MyDontRetryException.class, backoff = @Backoff(delay = 50, maxDelay = 100, multiplier = 3), traversingCauses = "true", kafkaTemplate = "${kafka.template}") @@ -485,7 +479,6 @@ public void annotatedDltMethod(Object message) { } } - @Component @RetryableTopic(attempts = "2", backoff = @Backoff(50)) @KafkaListener(id = "reuseRetry1", topics = FIRST_REUSE_RETRY_TOPIC, containerFactory = "retryTopicListenerContainerFactory") @@ -505,7 +498,6 @@ public void listen1(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) String } - @Component @RetryableTopic(attempts = "5", backoff = @Backoff(delay = 30, maxDelay = 100, multiplier = 2)) @KafkaListener(id = "reuseRetry2", topics = SECOND_REUSE_RETRY_TOPIC, containerFactory = "retryTopicListenerContainerFactory") @@ -525,7 +517,6 @@ public void listen2(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) String } - @Component @RetryableTopic(attempts = "5", backoff = @Backoff(delay = 1, maxDelay = 5, multiplier = 1.4)) @KafkaListener(id = "reuseRetry3", topics = THIRD_REUSE_RETRY_TOPIC, containerFactory = "retryTopicListenerContainerFactory") @@ -545,7 +536,6 @@ public void listen3(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) String } - @Component static class CountDownLatchContainer { CountDownLatch countDownLatch1 = new CountDownLatch(5); @@ -594,7 +584,6 @@ private void countDownIfNotKnown(String receivedTopic, CountDownLatch countDownL } } - @Component static class MyCustomDltProcessor { @Autowired diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicIntegrationTests.java index 5dd6de3bd5..e0e4a82c69 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicIntegrationTests.java @@ -84,7 +84,6 @@ import org.springframework.retry.annotation.Backoff; import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; -import org.springframework.stereotype.Component; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; @@ -94,6 +93,7 @@ * @author Tomaz Fernandes * @author Gary Russell * @author Wang Zhiyang + * @author Sanghyeok An * @since 2.7 */ @SpringJUnitConfig @@ -315,7 +315,6 @@ private boolean awaitLatch(CountDownLatch latch) { } } - @Component static class FirstTopicListener { @Autowired @@ -335,7 +334,6 @@ public void listen(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) String r } - @Component static class SecondTopicListener { @Autowired @@ -349,7 +347,6 @@ public void listenAgain(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) Str } } - @Component static class ThirdTopicListener { @Autowired @@ -377,7 +374,6 @@ public void annotatedDltMethod(Object message) { } } - @Component static class FourthTopicListener { @Autowired @@ -465,7 +461,6 @@ public void annotatedDltMethod(ConsumerRecord record) { } - @Component static class SixthTopicDefaultDLTListener { @Autowired @@ -484,7 +479,6 @@ public void listenNoDlt(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) Str } - @Component static class NoRetryTopicListener { @Autowired @@ -507,7 +501,6 @@ public void annotatedDltMethod(Object message) { } } - @Component static class FirstReuseRetryTopicListener { final List topics = Collections.synchronizedList(new ArrayList<>()); @@ -527,7 +520,6 @@ public void listen1(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) String } - @Component static class SecondReuseRetryTopicListener { final List topics = Collections.synchronizedList(new ArrayList<>()); @@ -547,7 +539,6 @@ public void listen2(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) String } - @Component static class ThirdReuseRetryTopicListener { final List topics = Collections.synchronizedList(new ArrayList<>()); @@ -567,7 +558,6 @@ public void listen3(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) String } - @Component static class CountDownLatchContainer { CountDownLatch countDownLatch1 = new CountDownLatch(5); @@ -618,7 +608,6 @@ private void countDownIfNotKnown(String receivedTopic, CountDownLatch countDownL } } - @Component static class MyCustomDltProcessor { @Autowired