Skip to content

Commit 12f2084

Browse files
garyrussellartembilan
authored andcommitted
Switch to spring-kafka 3.0.0-SNAPSHOT
- deprecations are temporarily restored there - fix deprecation warnings - re-enable tests for Windows
1 parent 70587f5 commit 12f2084

13 files changed

+71
-63
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ ext {
100100
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '3.0.0-SNAPSHOT'
101101
springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : '2022.0.0-SNAPSHOT'
102102
springGraphqlVersion = '1.0.0-SNAPSHOT'
103-
springKafkaVersion = '3.0.0-M1'
103+
springKafkaVersion = '3.0.0-SNAPSHOT'
104104
springRetryVersion = '1.3.1'
105105
springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '6.0.0-SNAPSHOT'
106106
springVersion = project.hasProperty('springVersion') ? project.springVersion : '6.0.0-SNAPSHOT'

spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/KafkaMessageListenerContainerSpec.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018-2021 the original author or authors.
2+
* Copyright 2018-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,7 +26,6 @@
2626
import org.springframework.kafka.core.ConsumerFactory;
2727
import org.springframework.kafka.listener.ConcurrentMessageListenerContainer;
2828
import org.springframework.kafka.listener.ContainerProperties;
29-
import org.springframework.kafka.listener.GenericErrorHandler;
3029
import org.springframework.kafka.support.TopicPartitionOffset;
3130

3231
/**
@@ -88,7 +87,10 @@ public KafkaMessageListenerContainerSpec<K, V> concurrency(int concurrency) {
8887
* @return the spec.
8988
* @see org.springframework.kafka.listener.ErrorHandler
9089
*/
91-
public KafkaMessageListenerContainerSpec<K, V> errorHandler(GenericErrorHandler<?> errorHandler) {
90+
@SuppressWarnings("deprecation")
91+
public KafkaMessageListenerContainerSpec<K, V> errorHandler(
92+
org.springframework.kafka.listener.GenericErrorHandler<?> errorHandler) {
93+
9294
this.target.setGenericErrorHandler(errorHandler);
9395
return this;
9496
}

spring-integration-kafka/src/main/java/org/springframework/integration/kafka/inbound/KafkaInboundGateway.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018-2021 the original author or authors.
2+
* Copyright 2018-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -170,6 +170,7 @@ public void setBindSourceRecord(boolean bindSourceRecord) {
170170
this.bindSourceRecord = bindSourceRecord;
171171
}
172172

173+
@SuppressWarnings("deprecation")
173174
@Override
174175
protected void onInit() {
175176
super.onInit();

spring-integration-kafka/src/main/java/org/springframework/integration/kafka/inbound/KafkaMessageDrivenChannelAdapter.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2021 the original author or authors.
2+
* Copyright 2015-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -261,6 +261,7 @@ public String getComponentType() {
261261
return "kafka:message-driven-channel-adapter";
262262
}
263263

264+
@SuppressWarnings("deprecation")
264265
@Override
265266
protected void onInit() {
266267
super.onInit();

spring-integration-kafka/src/test/java/org/springframework/integration/kafka/channnel/ChannelTests.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2021 the original author or authors.
2+
* Copyright 2020-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,8 +25,6 @@
2525

2626
import org.apache.kafka.clients.consumer.ConsumerConfig;
2727
import org.junit.jupiter.api.Test;
28-
import org.junit.jupiter.api.condition.DisabledOnOs;
29-
import org.junit.jupiter.api.condition.OS;
3028

3129
import org.springframework.beans.factory.annotation.Autowired;
3230
import org.springframework.context.annotation.Bean;
@@ -59,7 +57,6 @@
5957
* @since 5.4
6058
*
6159
*/
62-
@DisabledOnOs(OS.WINDOWS)
6360
@SpringJUnitConfig
6461
@EmbeddedKafka(topics = { "channel.1", "channel.2", "channel.3" }, partitions = 1)
6562
public class ChannelTests {

spring-integration-kafka/src/test/java/org/springframework/integration/kafka/config/xml/AllXmlTests.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2021 the original author or authors.
2+
* Copyright 2019-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,8 +19,6 @@
1919
import static org.assertj.core.api.Assertions.assertThat;
2020

2121
import org.junit.jupiter.api.Test;
22-
import org.junit.jupiter.api.condition.DisabledOnOs;
23-
import org.junit.jupiter.api.condition.OS;
2422

2523
import org.springframework.beans.factory.annotation.Autowired;
2624
import org.springframework.kafka.core.KafkaTemplate;
@@ -36,7 +34,6 @@
3634
* @since 5.4
3735
*
3836
*/
39-
@DisabledOnOs(OS.WINDOWS)
4037
@SpringJUnitConfig
4138
@DirtiesContext
4239
@EmbeddedKafka(topics = { "one", "two", "three", "four" })

spring-integration-kafka/src/test/java/org/springframework/integration/kafka/config/xml/KafkaMessageDrivenChannelAdapterParserTests.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2019 the original author or authors.
2+
* Copyright 2015-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,7 +36,6 @@
3636
import org.springframework.kafka.listener.KafkaMessageListenerContainer;
3737
import org.springframework.kafka.listener.adapter.FilteringMessageListenerAdapter;
3838
import org.springframework.kafka.listener.adapter.RecordFilterStrategy;
39-
import org.springframework.kafka.listener.adapter.RetryingMessageListenerAdapter;
4039
import org.springframework.retry.RecoveryCallback;
4140
import org.springframework.retry.support.RetryTemplate;
4241
import org.springframework.test.annotation.DirtiesContext;
@@ -110,7 +109,7 @@ void testKafkaBatchMessageDrivenChannelAdapterParser() {
110109
}
111110

112111
@Test
113-
@SuppressWarnings("unchecked")
112+
@SuppressWarnings({ "unchecked", "deprecation" })
114113
void testKafkaMessageDrivenChannelAdapterOptions() {
115114
DefaultKafkaConsumerFactory<Integer, String> cf =
116115
new DefaultKafkaConsumerFactory<>(Collections.emptyMap());
@@ -137,7 +136,8 @@ void testKafkaMessageDrivenChannelAdapterOptions() {
137136
adapter.afterPropertiesSet();
138137

139138
messageListener = containerProps.getMessageListener();
140-
assertThat(messageListener).isInstanceOf(RetryingMessageListenerAdapter.class);
139+
assertThat(messageListener).isInstanceOf(
140+
org.springframework.kafka.listener.adapter.RetryingMessageListenerAdapter.class);
141141

142142
delegate = TestUtils.getPropertyValue(messageListener, "delegate");
143143

@@ -151,13 +151,15 @@ void testKafkaMessageDrivenChannelAdapterOptions() {
151151

152152
delegate = TestUtils.getPropertyValue(messageListener, "delegate");
153153

154-
assertThat(delegate).isInstanceOf(RetryingMessageListenerAdapter.class);
154+
assertThat(delegate).isInstanceOf(
155+
org.springframework.kafka.listener.adapter.RetryingMessageListenerAdapter.class);
155156

156157
adapter.setFilterInRetry(true);
157158
adapter.afterPropertiesSet();
158159

159160
messageListener = containerProps.getMessageListener();
160-
assertThat(messageListener).isInstanceOf(RetryingMessageListenerAdapter.class);
161+
assertThat(messageListener).isInstanceOf(
162+
org.springframework.kafka.listener.adapter.RetryingMessageListenerAdapter.class);
161163

162164
delegate = TestUtils.getPropertyValue(messageListener, "delegate");
163165

spring-integration-kafka/src/test/java/org/springframework/integration/kafka/dsl/KafkaDslTests.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2021 the original author or authors.
2+
* Copyright 2015-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -32,8 +32,6 @@
3232
import org.apache.kafka.clients.producer.ProducerConfig;
3333
import org.apache.kafka.common.TopicPartition;
3434
import org.junit.jupiter.api.Test;
35-
import org.junit.jupiter.api.condition.DisabledOnOs;
36-
import org.junit.jupiter.api.condition.OS;
3735

3836
import org.springframework.beans.factory.annotation.Autowired;
3937
import org.springframework.beans.factory.annotation.Qualifier;
@@ -95,7 +93,6 @@
9593
*
9694
* @since 5.4
9795
*/
98-
@DisabledOnOs(OS.WINDOWS)
9996
@SpringJUnitConfig
10097
@DirtiesContext
10198
@EmbeddedKafka(topics = { KafkaDslTests.TEST_TOPIC1, KafkaDslTests.TEST_TOPIC2, KafkaDslTests.TEST_TOPIC3,
@@ -307,6 +304,7 @@ public IntegrationFlow topic1ListenerFromKafkaFlow() {
307304
.get();
308305
}
309306

307+
@SuppressWarnings("deprecation")
310308
@Bean
311309
public ConcurrentKafkaListenerContainerFactory<Integer, String> kafkaListenerContainerFactory() {
312310
ConcurrentKafkaListenerContainerFactory<Integer, String> factory =

spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/InboundGatewayTests.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018-2021 the original author or authors.
2+
* Copyright 2018-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -32,8 +32,6 @@
3232
import org.junit.jupiter.api.AfterAll;
3333
import org.junit.jupiter.api.BeforeAll;
3434
import org.junit.jupiter.api.Test;
35-
import org.junit.jupiter.api.condition.DisabledOnOs;
36-
import org.junit.jupiter.api.condition.OS;
3735

3836
import org.springframework.beans.factory.BeanFactory;
3937
import org.springframework.integration.IntegrationMessageHeaderAccessor;
@@ -78,7 +76,6 @@
7876
* @since 5.4
7977
*
8078
*/
81-
@DisabledOnOs(OS.WINDOWS)
8279
class InboundGatewayTests {
8380

8481
private static String topic1 = "testTopic1";

spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/MessageDrivenAdapterTests.java

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2021 the original author or authors.
2+
* Copyright 2016-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -52,8 +52,6 @@
5252
import org.junit.jupiter.api.AfterAll;
5353
import org.junit.jupiter.api.BeforeAll;
5454
import org.junit.jupiter.api.Test;
55-
import org.junit.jupiter.api.condition.DisabledOnOs;
56-
import org.junit.jupiter.api.condition.OS;
5755

5856
import org.springframework.integration.IntegrationMessageHeaderAccessor;
5957
import org.springframework.integration.StaticMessageHeaderAccessor;
@@ -73,8 +71,8 @@
7371
import org.springframework.kafka.event.ConsumerResumedEvent;
7472
import org.springframework.kafka.event.KafkaEvent;
7573
import org.springframework.kafka.listener.ContainerProperties;
74+
import org.springframework.kafka.listener.DefaultErrorHandler;
7675
import org.springframework.kafka.listener.KafkaMessageListenerContainer;
77-
import org.springframework.kafka.listener.SeekToCurrentErrorHandler;
7876
import org.springframework.kafka.support.Acknowledgment;
7977
import org.springframework.kafka.support.DefaultKafkaHeaderMapper;
8078
import org.springframework.kafka.support.KafkaHeaders;
@@ -111,7 +109,6 @@
111109
* @since 5.4
112110
*
113111
*/
114-
@DisabledOnOs(OS.WINDOWS)
115112
class MessageDrivenAdapterTests {
116113

117114
private static String topic1 = "testTopic1";
@@ -343,7 +340,7 @@ void testInboundRecordNoRetryRecover() {
343340
containerProps.setDeliveryAttemptHeader(true);
344341
KafkaMessageListenerContainer<Integer, String> container =
345342
new KafkaMessageListenerContainer<>(cf, containerProps);
346-
container.setErrorHandler(new SeekToCurrentErrorHandler());
343+
container.setCommonErrorHandler(new DefaultErrorHandler());
347344
KafkaMessageDrivenChannelAdapter<Integer, String> adapter = new KafkaMessageDrivenChannelAdapter<>(container);
348345
MessageChannel out = new DirectChannel() {
349346

spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/MessageSourceIntegrationTests.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018-2021 the original author or authors.
2+
* Copyright 2018-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,8 +29,6 @@
2929
import org.junit.jupiter.api.AfterAll;
3030
import org.junit.jupiter.api.BeforeAll;
3131
import org.junit.jupiter.api.Test;
32-
import org.junit.jupiter.api.condition.DisabledOnOs;
33-
import org.junit.jupiter.api.condition.OS;
3432

3533
import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
3634
import org.springframework.kafka.core.DefaultKafkaProducerFactory;
@@ -48,7 +46,6 @@
4846
* @since 5.4
4947
*
5048
*/
51-
@DisabledOnOs(OS.WINDOWS)
5249
class MessageSourceIntegrationTests {
5350

5451
private static final String TOPIC1 = "MessageSourceIntegrationTests1";

0 commit comments

Comments
 (0)