Skip to content

Commit e76fc5c

Browse files
committed
Upgrade to kafka 2.5.1
1 parent e58f683 commit e76fc5c

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ ext {
5656
jaywayJsonPathVersion = '2.4.0'
5757
junit4Version = '4.13'
5858
junitJupiterVersion = '5.6.2'
59-
kafkaVersion = '2.5.0'
59+
kafkaVersion = '2.5.1'
6060
log4jVersion = '2.13.2'
6161
micrometerVersion = '1.5.2'
6262
mockitoVersion = '3.3.3'

spring-kafka/src/test/java/org/springframework/kafka/config/StreamsBuilderFactoryBeanTests.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@
2626
import java.nio.file.Paths;
2727
import java.util.HashMap;
2828
import java.util.Map;
29+
import java.util.regex.Pattern;
2930

3031
import org.apache.kafka.streams.StreamsBuilder;
3132
import org.apache.kafka.streams.StreamsConfig;
33+
import org.apache.kafka.streams.kstream.KStream;
34+
import org.apache.kafka.streams.kstream.KTable;
35+
import org.apache.kafka.streams.kstream.Materialized;
3236
import org.junit.jupiter.api.BeforeAll;
3337
import org.junit.jupiter.api.Test;
3438
import org.junit.jupiter.api.condition.DisabledOnOs;
@@ -76,7 +80,6 @@ public static void setup() throws IOException {
7680

7781
@Test
7882
public void testCleanupStreams() throws IOException {
79-
Files.createDirectory(Paths.get(stateStoreDir.toString(), APPLICATION_ID));
8083
Path stateStore = Files.createDirectory(Paths.get(stateStoreDir.toString(), APPLICATION_ID, "0_0"));
8184
assertThat(stateStore).exists();
8285
streamsBuilderFactoryBean.stop();
@@ -97,6 +100,8 @@ protected StreamsBuilder createInstance() {
97100
}
98101
};
99102
streamsBuilderFactoryBean.afterPropertiesSet();
103+
StreamsBuilder builder = streamsBuilderFactoryBean.getObject();
104+
builder.stream(Pattern.compile("foo"));
100105
streamsBuilderFactoryBean.start();
101106
StreamsBuilder streamsBuilder = streamsBuilderFactoryBean.getObject();
102107
verify(streamsBuilder).build(kafkaStreamsConfiguration.asProperties());
@@ -125,6 +130,13 @@ public KafkaStreamsConfiguration kStreamsConfigs() {
125130
return new KafkaStreamsConfiguration(props);
126131
}
127132

133+
@Bean
134+
public KTable<?, ?> table(StreamsBuilder builder) {
135+
KStream<Object, Object> stream = builder.stream(Pattern.compile("foo"));
136+
return stream.groupByKey()
137+
.count(Materialized.as("store"));
138+
139+
}
128140
}
129141

130142
}

spring-kafka/src/test/java/org/springframework/kafka/config/StreamsBuilderFactoryLateConfigTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018-2019 the original author or authors.
2+
* Copyright 2018-2020 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.
@@ -21,6 +21,7 @@
2121
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
2222

2323
import java.util.Properties;
24+
import java.util.regex.Pattern;
2425

2526
import org.apache.kafka.streams.StreamsConfig;
2627
import org.junit.jupiter.api.Test;
@@ -70,11 +71,12 @@ public void testStreamBuilderFactoryCannotBeInstantiatedWhenAutoStart() {
7071
}
7172

7273
@Test
73-
public void testStreamsBuilderFactoryWithConfigProvidedLater() {
74+
public void testStreamsBuilderFactoryWithConfigProvidedLater() throws Exception {
7475
Properties props = new Properties();
7576
props.put(StreamsConfig.APPLICATION_ID_CONFIG, APPLICATION_ID);
7677
props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, this.brokerAddresses);
7778
streamsBuilderFactoryBean.setStreamsConfiguration(props);
79+
streamsBuilderFactoryBean.getObject().stream(Pattern.compile("foo"));
7880

7981
assertThat(streamsBuilderFactoryBean.isRunning()).isFalse();
8082
streamsBuilderFactoryBean.start();

0 commit comments

Comments
 (0)