Skip to content

Commit

Permalink
Upgrade some deps; fix deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
artembilan committed Aug 12, 2023
1 parent 50bf00e commit c157b9b
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 54 deletions.
28 changes: 14 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ plugins {
id 'org.sonarqube' version '4.3.0.3225'
id 'io.spring.nohttp' version '0.0.11' apply false
id 'org.ajoberstar.grgit' version '4.1.1'
id 'io.spring.dependency-management' version '1.1.2'
id 'com.jfrog.artifactory' version '4.33.1' apply false
id 'io.spring.dependency-management' version '1.1.3'
id 'com.jfrog.artifactory' version '5.0.3' apply false
id 'org.jetbrains.dokka' version '1.8.20'
id 'org.antora' version '1.0.0'
id 'io.spring.antora.generate-antora-yml' version '0.0.1'
Expand All @@ -45,8 +45,8 @@ ext {
linkScmConnection = 'scm:git:git://github.com/spring-projects/spring-integration.git'
linkScmDevConnection = 'scm:git:ssh://git@github.com:spring-projects/spring-integration.git'

modifiedFiles = providers.provider {
files(grgit.status().unstaged.modified).filter { f -> f.name.endsWith('.java') || f.name.endsWith('.kt') } }
modifiedFiles =
files(grgit.status().unstaged.modified).filter { f -> f.name.endsWith('.java') || f.name.endsWith('.kt') }

apacheSshdVersion = '2.10.0'
artemisVersion = '2.29.0'
Expand All @@ -55,7 +55,7 @@ ext {
assertkVersion = '0.26.1'
avroVersion = '1.11.2'
awaitilityVersion = '4.2.0'
camelVersion = '4.0.0-RC1'
camelVersion = '4.0.0-RC2'
commonsDbcp2Version = '2.9.0'
commonsIoVersion = '2.13.0'
commonsNetVersion = '3.9.0'
Expand All @@ -81,35 +81,35 @@ ext {
jrubyVersion = '9.4.3.0'
jsonpathVersion = '2.8.0'
junit4Version = '4.13.2'
junitJupiterVersion = '5.10.0-RC1'
junitJupiterVersion = '5.10.0'
jythonVersion = '2.7.3'
kotlinCoroutinesVersion = '1.7.2'
kryoVersion = '5.5.0'
lettuceVersion = '6.2.4.RELEASE'
log4jVersion = '2.20.0'
mailVersion = '2.0.2'
micrometerTracingVersion = '1.2.0-M1'
micrometerVersion = '1.12.0-M1'
micrometerTracingVersion = '1.2.0-SNAPSHOT'
micrometerVersion = '1.12.0-SNAPSHOT'
mockitoVersion = '5.4.0'
mongoDriverVersion = '4.10.2'
mysqlVersion = '8.0.33'
pahoMqttClientVersion = '1.2.5'
postgresVersion = '42.6.0'
protobufVersion = '3.24.0-RC1'
protobufVersion = '3.24.0-RC2'
r2dbch2Version = '1.0.0.RELEASE'
reactorVersion = '2023.0.0-M1'
reactorVersion = '2023.0.0-SNAPSHOT'
resilience4jVersion = '2.1.0'
romeToolsVersion = '2.1.0'
rsocketVersion = '1.1.4'
servletApiVersion = '6.0.0'
smackVersion = '4.4.6'
springAmqpVersion = '3.0.6'
springDataVersion = '2023.1.0-M1'
springDataVersion = '2023.1.0-SNAPSHOT'
springGraphqlVersion = '1.2.2'
springKafkaVersion = '3.0.10-SNAPSHOT'
springRetryVersion = '2.0.2'
springSecurityVersion = '6.2.0-M1'
springVersion = '6.1.0-M2'
springSecurityVersion = '6.2.0-SNAPSHOT'
springVersion = '6.1.0-SNAPSHOT'
springWsVersion = '4.0.4'
testcontainersVersion = '1.18.3'
tomcatVersion = '10.1.11'
Expand Down Expand Up @@ -290,7 +290,7 @@ configure(javaProjects) { subproject ->

tasks.register('updateCopyrights') {
onlyIf { !isCI }
inputs.files(modifiedFiles.map(files -> files.filter { f -> f.path.contains(subproject.name) }))
inputs.files(modifiedFiles.filter { f -> f.path.contains(subproject.name) })
outputs.dir('build/classes')

doLast {
Expand Down
17 changes: 11 additions & 6 deletions gradle/docs.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,22 @@ ext {
antora {
version = '3.2.0-alpha.2'
playbook = file('src/reference/antora/antora-playbook.yml')
options = ['to-dir' : project.layout.buildDirectory.dir('site').get().toString(), clean: true, fetch: !project.gradle.startParameter.offline, stacktrace: true]
options = [
'to-dir' : project.layout.buildDirectory.dir('site').get().toString(),
clean: true,
fetch: !project.gradle.startParameter.offline,
stacktrace: true
]
dependencies = [
'@antora/atlas-extension': '1.0.0-alpha.1',
'@antora/atlas-extension': '1.0.0-alpha.2',
'@antora/collector-extension': '1.0.0-alpha.3',
'@asciidoctor/tabs': '1.0.0-beta.3',
'@springio/antora-extensions': '1.4.2',
'@springio/asciidoctor-extensions': '1.0.0-alpha.8',
'@asciidoctor/tabs': '1.0.0-beta.6',
'@springio/antora-extensions': '1.5.0',
'@springio/asciidoctor-extensions': '1.0.0-alpha.9',
]
}

tasks.named("generateAntoraYml") {
tasks.named('generateAntoraYml') {
asciidocAttributes = project.provider( {
return ['project-version' : project.version ]
} )
Expand Down
4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'com.gradle.enterprise' version '3.13.4'
id 'io.spring.ge.conventions' version '0.0.13'
id 'com.gradle.enterprise' version '3.14.1'
id 'io.spring.ge.conventions' version '0.0.14'
}

rootProject.name = 'spring-integration'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 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.
Expand Down Expand Up @@ -27,9 +27,9 @@

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.integration.channel.DirectChannel;
Expand All @@ -50,6 +50,7 @@
import org.springframework.util.StopWatch;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.Mockito.mock;

/**
Expand All @@ -69,7 +70,7 @@ public class AggregatorTests {

private final List<MessageGroupExpiredEvent> expiryEvents = new ArrayList<>();

@Before
@BeforeEach
public void configureAggregator() {
this.aggregator = new AggregatingMessageHandler(new MultiplyingProcessor(), store);
this.aggregator.setBeanFactory(mock(BeanFactory.class));
Expand All @@ -80,7 +81,7 @@ public void configureAggregator() {
}

@Test
@Ignore
@Disabled
public void testAggPerf() throws InterruptedException, ExecutionException, TimeoutException {
AggregatingMessageHandler handler = new AggregatingMessageHandler(new DefaultAggregatingMessageGroupProcessor());
handler.setCorrelationStrategy(message -> "foo");
Expand Down Expand Up @@ -170,7 +171,7 @@ public void testAggPerfDefaultPartial() throws InterruptedException, ExecutionEx
}
stopwatch.stop();
logger.warn("Sent " + 120000 + " in " + stopwatch.getTotalTimeSeconds() +
" (10k in " + stopwatch.getLastTaskTimeMillis() + "ms)");
" (10k in " + stopwatch.lastTaskInfo().getTimeMillis() + "ms)");

Collection<?> result = resultFuture.get(10, TimeUnit.SECONDS);
assertThat(result).isNotNull();
Expand All @@ -186,7 +187,7 @@ class CustomHandler extends AbstractMessageHandler {

private final ReentrantLock lock = new ReentrantLock();

private final Collection<Message<?>> messages = new ArrayList<Message<?>>(60000);
private final Collection<Message<?>> messages = new ArrayList<>(60000);

private final MessageChannel outputChannel;

Expand Down Expand Up @@ -233,14 +234,14 @@ public void handleMessageInternal(Message<?> requestMessage) {
if (i % 10000 == 0) {
stopwatch.stop();
logger.warn("Sent " + i + " in " + stopwatch.getTotalTimeSeconds() +
" (10k in " + stopwatch.getLastTaskTimeMillis() + "ms)");
" (10k in " + stopwatch.lastTaskInfo().getTimeMillis() + "ms)");
stopwatch.start();
}
handler.handleMessage(message);
}
stopwatch.stop();
logger.warn("Sent " + 120000 + " in " + stopwatch.getTotalTimeSeconds() +
" (10k in " + stopwatch.getLastTaskTimeMillis() + "ms)");
" (10k in " + stopwatch.lastTaskInfo().getTimeMillis() + "ms)");

Collection<?> result = resultFuture.get(10, TimeUnit.SECONDS);
assertThat(result).isNotNull();
Expand Down Expand Up @@ -465,7 +466,7 @@ public void testMultipleGroupsSimultaneously() {
}

@Test
@Ignore
@Disabled
// dropped backwards compatibility for setting capacity limit (it's always Integer.MAX_VALUE)
public void testTrackedCorrelationIdsCapacityAtLimit() {
QueueChannel replyChannel = new QueueChannel();
Expand All @@ -484,7 +485,7 @@ public void testTrackedCorrelationIdsCapacityAtLimit() {
}

@Test
@Ignore
@Disabled
// dropped backwards compatibility for setting capacity limit (it's always Integer.MAX_VALUE)
public void testTrackedCorrelationIdsCapacityPassesLimit() {
QueueChannel replyChannel = new QueueChannel();
Expand All @@ -504,10 +505,11 @@ public void testTrackedCorrelationIdsCapacityPassesLimit() {
assertThat(discardChannel.receive(0)).isNull();
}

@Test(expected = MessageHandlingException.class)
@Test
public void testExceptionThrownIfNoCorrelationId() throws InterruptedException {
Message<?> message = createMessage(3, null, 2, 1, new QueueChannel(), null);
this.aggregator.handleMessage(message);
assertThatExceptionOfType(MessageHandlingException.class)
.isThrownBy(() -> this.aggregator.handleMessage(message));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 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.
Expand All @@ -20,7 +20,7 @@
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import org.springframework.messaging.MessagingException;
import org.springframework.util.StopWatch;
Expand Down Expand Up @@ -70,7 +70,8 @@ public TcpConnection getConnection() {
watch.start();
factory.stop();
watch.stop();
assertThat(watch.getLastTaskTimeMillis() < 10000).as("Expected < 10000, was: " + watch.getLastTaskTimeMillis())
assertThat(watch.lastTaskInfo().getTimeMillis() < 10000)
.as("Expected < 10000, was: " + watch.lastTaskInfo().getTimeMillis())
.isTrue();
assertThat(latch1.await(10, TimeUnit.SECONDS)).isTrue();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
import org.springframework.kafka.listener.ConsumerAwareRebalanceListener;
import org.springframework.kafka.listener.ConsumerProperties;
import org.springframework.kafka.listener.ErrorHandlingUtils;
import org.springframework.kafka.listener.ListenerUtils;
import org.springframework.kafka.listener.LoggingCommitCallback;
import org.springframework.kafka.support.Acknowledgment;
import org.springframework.kafka.support.DefaultKafkaHeaderMapper;
Expand Down Expand Up @@ -281,7 +280,6 @@ protected void onInit() {
this.consumerProperties.setClientId(getComponentName());
}

Map<String, Object> props = this.consumerFactory.getConfigurationProperties();
Properties kafkaConsumerProperties = this.consumerProperties.getKafkaConsumerProperties();
this.checkNullKeyForExceptions =
this.consumerProperties.isCheckDeserExWhenKeyNull() ||
Expand Down Expand Up @@ -390,16 +388,7 @@ private ConsumerFactory<K, V> fixOrRejectConsumerFactory(ConsumerFactory<K, V> s
this.logger.warn(() -> ConsumerConfig.MAX_POLL_RECORDS_CONFIG
+ "' has been forced from " + (maxPoll == null ? "unspecified" : maxPoll)
+ " to 1, to avoid having to seek after each record");
Map<String, Object> configs = new HashMap<>(suppliedConsumerFactory.getConfigurationProperties());
configs.put(ConsumerConfig.MAX_POLL_RECORDS_CONFIG, 1);
DefaultKafkaConsumerFactory<K, V> fixedConsumerFactory = new DefaultKafkaConsumerFactory<>(configs);
if (suppliedConsumerFactory.getKeyDeserializer() != null) {
fixedConsumerFactory.setKeyDeserializer(suppliedConsumerFactory.getKeyDeserializer());
}
if (suppliedConsumerFactory.getValueDeserializer() != null) {
fixedConsumerFactory.setValueDeserializer(suppliedConsumerFactory.getValueDeserializer());
}
return fixedConsumerFactory;
return fixConsumerFactory(suppliedConsumerFactory);
}
else {
return suppliedConsumerFactory;
Expand Down Expand Up @@ -494,7 +483,7 @@ protected Object doReceive() {
createConsumer();
this.running = true;
}
if (this.pausing && !this.paused && this.assignedPartitions.size() > 0) {
if (this.pausing && !this.paused && !this.assignedPartitions.isEmpty()) {
this.consumer.pause(this.assignedPartitions);
this.paused = true;
}
Expand Down Expand Up @@ -675,8 +664,8 @@ private Object recordToMessage(ConsumerRecord<K, V> record) {
}
}

private void checkDeserializationException(ConsumerRecord<K, V> cRecord, String headerName) {
DeserializationException exception = ListenerUtils.getExceptionFromHeader(cRecord, headerName, this.logger);
private void checkDeserializationException(ConsumerRecord<K, V> record, String headerName) {
DeserializationException exception = SerializationUtils.getExceptionFromHeader(record, headerName, this.logger);
if (exception != null) {
throw exception;
}
Expand Down Expand Up @@ -707,6 +696,19 @@ private void stopConsumer() {
}
}

private static <K, V> ConsumerFactory<K, V> fixConsumerFactory(ConsumerFactory<K, V> suppliedConsumerFactory) {
Map<String, Object> configs = new HashMap<>(suppliedConsumerFactory.getConfigurationProperties());
configs.put(ConsumerConfig.MAX_POLL_RECORDS_CONFIG, 1);
DefaultKafkaConsumerFactory<K, V> fixedConsumerFactory = new DefaultKafkaConsumerFactory<>(configs);
if (suppliedConsumerFactory.getKeyDeserializer() != null) {
fixedConsumerFactory.setKeyDeserializer(suppliedConsumerFactory.getKeyDeserializer());
}
if (suppliedConsumerFactory.getValueDeserializer() != null) {
fixedConsumerFactory.setValueDeserializer(suppliedConsumerFactory.getValueDeserializer());
}
return fixedConsumerFactory;
}

private class IntegrationConsumerRebalanceListener implements ConsumerRebalanceListener {

private final ConsumerRebalanceListener providedRebalanceListener;
Expand Down

0 comments on commit c157b9b

Please sign in to comment.