From d6bf681aa43cfd83610c507e2cff1b992b305c7d Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Tue, 18 Jan 2022 17:14:33 -0500 Subject: [PATCH] Upgrade dependencies; prepare for release * Upgrade to Gradle `7.3.3` * Upgrade to the latest milestones for releasing * Upgrade to Kryo-5.2.1 and update source code according breaking changes * Upgrade to H2-2.1.210 and re-enable respective stored procedure tests --- build.gradle | 68 +++++++++---------- gradle/wrapper/gradle-wrapper.properties | 4 +- .../codec/kryo/AbstractKryoCodec.java | 58 ++++++++-------- .../codec/kryo/AbstractKryoRegistrar.java | 6 +- .../codec/kryo/FileSerializer.java | 8 ++- .../codec/kryo/MessageHeadersSerializer.java | 10 ++- .../kryo/MutableMessageHeadersSerializer.java | 7 +- .../integration/codec/kryo/PojoCodec.java | 6 +- .../http/outbound/CookieTests.java | 3 +- .../jdbc/StoredProcJavaConfigTests.java | 2 - ...lAdapterWithNamespaceIntegrationTests.java | 2 - ...pterWithSpringContextIntegrationTests.java | 2 - 12 files changed, 94 insertions(+), 82 deletions(-) diff --git a/build.gradle b/build.gradle index 16a66eccfd..9a3a624941 100644 --- a/build.gradle +++ b/build.gradle @@ -15,9 +15,9 @@ buildscript { plugins { id 'org.sonarqube' version '2.8' id 'io.spring.nohttp' version '0.0.10' apply false - id 'org.ajoberstar.grgit' version '4.1.0' + id 'org.ajoberstar.grgit' version '4.1.1' id 'io.spring.dependency-management' version '1.0.11.RELEASE' - id 'com.jfrog.artifactory' version '4.24.20' apply false + id 'com.jfrog.artifactory' version '4.26.1' apply false id 'org.jetbrains.dokka' version '1.6.10' id 'org.asciidoctor.jvm.pdf' version '3.3.2' id 'org.asciidoctor.jvm.gems' version '3.3.2' @@ -48,64 +48,64 @@ ext { files(grgit.status().unstaged.modified).filter { f -> f.name.endsWith('.java') || f.name.endsWith('.kt') } apacheSshdVersion = '2.8.0' - artemisVersion = '2.19.0' - aspectjVersion = '1.9.7' - assertjVersion = '3.21.0' + artemisVersion = '2.20.0' + aspectjVersion = '1.9.8.RC3' + assertjVersion = '3.22.0' assertkVersion = '0.25' - avroVersion = '1.10.2' + avroVersion = '1.11.0' awaitilityVersion = '4.1.1' commonsDbcp2Version = '2.9.0' commonsIoVersion = '2.11.0' commonsNetVersion = '3.8.0' curatorVersion = '4.3.0' derbyVersion = '10.14.2.0' - ftpServerVersion = '1.1.1' + ftpServerVersion = '1.1.2' googleJsr305Version = '3.0.2' greenmailVersion = '2.0.0-alpha-2' groovyVersion = '3.0.9' hamcrestVersion = '2.2' hazelcastVersion = '5.0.2' - hibernateVersion = '5.6.1.Final' - hsqldbVersion = '2.6.0' - h2Version = '2.0.206' - jacksonVersion = '2.13.0' + hibernateVersion = '5.6.3.Final' + hsqldbVersion = '2.6.1' + h2Version = '2.1.210' + jacksonVersion = '2.13.1' jaxbVersion = '3.0.2' jeroMqVersion = '0.5.2' jmsApiVersion = '3.0.0' jpaApiVersion = '3.0.2' - jrubyVersion = '9.2.19.0' + jrubyVersion = '9.3.2.0' jschVersion = '0.1.55' jsonpathVersion = '2.6.0' junit4Version = '4.13.2' - junitJupiterVersion = '5.8.1' + junitJupiterVersion = '5.8.2' jythonVersion = '2.7.2' - kryoShadedVersion = '4.0.2' - lettuceVersion = '6.1.5.RELEASE' - log4jVersion = '2.17.0' + kryoVersion = '5.2.1' + lettuceVersion = '6.1.6.RELEASE' + log4jVersion = '2.17.1' mailVersion = '2.0.1' - micrometerVersion = '1.7.7' - mockitoVersion = '4.0.0' - mongoDriverVersion = '4.4.0' - mysqlVersion = '8.0.27' + micrometerVersion = '2.0.0-M1' + mockitoVersion = '4.2.0' + mongoDriverVersion = '4.4.1' + mysqlVersion = '8.0.28' pahoMqttClientVersion = '1.2.5' - postgresVersion = '42.2.23' - r2dbch2Version = '0.9.0.M1' - reactorVersion = '2020.0.14' + postgresVersion = '42.3.1' + r2dbch2Version = '0.9.0.RELEASE' + reactorVersion = '2020.0.15' resilience4jVersion = '1.7.1' - romeToolsVersion = '1.16.0' + romeToolsVersion = '1.18.0' rsocketVersion = '1.1.1' saajVersion = '2.0.1' servletApiVersion = '5.0.0' smackVersion = '4.3.5' - springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '3.0.0-SNAPSHOT' - springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : '2022.1.0-SNAPSHOT' - springKafkaVersion = '3.0.0-SNAPSHOT' + springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '3.0.0-M1' + springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : '2022.0.0-M1' + springKafkaVersion = '3.0.0-M1' springRetryVersion = '1.3.1' - springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '6.0.0-SNAPSHOT' - springVersion = project.hasProperty('springVersion') ? project.springVersion : '6.0.0-SNAPSHOT' - springWsVersion = '4.0.0-SNAPSHOT' + springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '6.0.0-M1' + springVersion = project.hasProperty('springVersion') ? project.springVersion : '6.0.0-M2' + springWsVersion = '4.0.0-M1' testcontainersVersion = '1.16.2' - tomcatVersion = '10.0.11' + tomcatVersion = '10.0.14' xmlUnitVersion = '2.8.4' xstreamVersion = '1.4.18' @@ -357,7 +357,7 @@ configure(javaProjects) { subproject -> checkstyle { configDirectory.set(rootProject.file('src/checkstyle')) - toolVersion = project.hasProperty('checkstyleVersion') ? project.checkstyleVersion : '9.2' + toolVersion = project.hasProperty('checkstyleVersion') ? project.checkstyleVersion : '9.2.1' } jar { @@ -497,7 +497,7 @@ project('spring-integration-core') { } optionalApi "com.jayway.jsonpath:json-path:$jsonpathVersion" - optionalApi "com.esotericsoftware:kryo-shaded:$kryoShadedVersion" + optionalApi "com.esotericsoftware:kryo:$kryoVersion" optionalApi "io.micrometer:micrometer-core:$micrometerVersion" optionalApi "io.github.resilience4j:resilience4j-ratelimiter:$resilience4jVersion" optionalApi "org.apache.avro:avro:$avroVersion" @@ -657,7 +657,7 @@ project('spring-integration-ip') { testImplementation project(':spring-integration-event') testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" - testRuntimeOnly "com.esotericsoftware:kryo-shaded:$kryoShadedVersion" + testRuntimeOnly "com.esotericsoftware:kryo:$kryoVersion" testRuntimeOnly 'com.fasterxml.jackson.core:jackson-databind' } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 46dcc66106..3e000b9fe3 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionSha256Sum=23b89f8eac363f5f4b8336e0530c7295c55b728a9caa5268fdd4a532610d5392 \ No newline at end of file +distributionSha256Sum=b586e04868a22fd817c8971330fec37e298f3242eb85c374181b12d637f80302 \ No newline at end of file diff --git a/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/AbstractKryoCodec.java b/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/AbstractKryoCodec.java index 90fd2644b0..7ea31a4d69 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/AbstractKryoCodec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/AbstractKryoCodec.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 the original author or authors. + * Copyright 2015-2022 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. @@ -27,69 +27,71 @@ import org.springframework.util.Assert; import com.esotericsoftware.kryo.Kryo; import com.esotericsoftware.kryo.io.Input; import com.esotericsoftware.kryo.io.Output; -import com.esotericsoftware.kryo.pool.KryoFactory; -import com.esotericsoftware.kryo.pool.KryoPool; +import com.esotericsoftware.kryo.util.Pool; /** * Base class for {@link Codec}s using {@link Kryo}. * Manages pooled {@link Kryo} instances. * * @author David Turanski + * @author Artem Bilan + * * @since 4.2 */ public abstract class AbstractKryoCodec implements Codec { - protected final KryoPool pool; // NOSONAR final + protected final Pool pool; // NOSONAR final protected AbstractKryoCodec() { - KryoFactory factory = () -> { - Kryo kryo = new Kryo(); - kryo.setRegistrationRequired(true); - // configure Kryo instance, customize settings - configureKryoInstance(kryo); - return kryo; + this.pool = new Pool<>(true, true) { + + @Override + protected Kryo create() { + Kryo kryo = new Kryo(); + kryo.setRegistrationRequired(true); + // configure Kryo instance, customize settings + configureKryoInstance(kryo); + return kryo; + } + }; - // Build pool with SoftReferences enabled (optional) - this.pool = new KryoPool.Builder(factory).softReferences().build(); } @Override public void encode(final Object object, OutputStream outputStream) { Assert.notNull(object, "cannot encode a null object"); Assert.notNull(outputStream, "'outputSteam' cannot be null"); - final Output output = (outputStream instanceof Output ? (Output) outputStream : new Output(outputStream)); - this.pool.run(kryo -> { + + Kryo kryo = this.pool.obtain(); + try (Output output = (outputStream instanceof Output ? (Output) outputStream : new Output(outputStream))) { doEncode(kryo, object, output); - return Void.class; - }); - output.close(); + } + finally { + this.pool.free(kryo); + } + } @Override public T decode(byte[] bytes, Class type) throws IOException { Assert.notNull(bytes, "'bytes' cannot be null"); - final Input input = new Input(bytes); - try { + try (Input input = new Input(bytes)) { return decode(input, type); } - finally { - input.close(); - } } @Override public T decode(InputStream inputStream, final Class type) { Assert.notNull(inputStream, "'inputStream' cannot be null"); Assert.notNull(type, "'type' cannot be null"); - final Input input = (inputStream instanceof Input ? (Input) inputStream : new Input(inputStream)); - T result = null; - try { - result = this.pool.run(kryo -> doDecode(kryo, input, type)); + + Kryo kryo = this.pool.obtain(); + try (Input input = (inputStream instanceof Input ? (Input) inputStream : new Input(inputStream))) { + return doDecode(kryo, input, type); } finally { - input.close(); + this.pool.free(kryo); } - return result; } @Override diff --git a/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/AbstractKryoRegistrar.java b/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/AbstractKryoRegistrar.java index 859f80ccfe..24c04a8fff 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/AbstractKryoRegistrar.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/AbstractKryoRegistrar.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 the original author or authors. + * Copyright 2015-2022 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,6 +34,10 @@ public abstract class AbstractKryoRegistrar implements KryoRegistrar { protected static final Kryo KRYO = new Kryo(); + static { + KRYO.setRegistrationRequired(false); + } + protected final Log log = LogFactory.getLog(getClass()); // NOSONAR property is final @Override diff --git a/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/FileSerializer.java b/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/FileSerializer.java index 003af38570..92a66af49c 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/FileSerializer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/FileSerializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2019 the original author or authors. + * Copyright 2015-2022 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. @@ -30,6 +30,8 @@ import com.esotericsoftware.kryo.io.Output; * is declared transient. * * @author David Turanski + * @author Artem Bilan + * * @since 4.2 */ public class FileSerializer extends Serializer { @@ -40,8 +42,8 @@ public class FileSerializer extends Serializer { } @Override - public File read(Kryo kryo, Input input, Class type) { - String path = input.readString(); + public File read(Kryo kryo, Input input, Class type) { + String path = input.readString(); return new File(path); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/MessageHeadersSerializer.java b/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/MessageHeadersSerializer.java index 5bd82c1df8..32a77d36bc 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/MessageHeadersSerializer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/MessageHeadersSerializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2019 the original author or authors. + * Copyright 2015-2022 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. @@ -28,13 +28,17 @@ import com.esotericsoftware.kryo.io.Output; /** * Kryo Serializer for {@link MessageHeaders}. + * * @author David Turanski + * @author Artem Bilan + * * @since 4.2 */ class MessageHeadersSerializer extends Serializer { + @Override public void write(Kryo kryo, Output output, MessageHeaders headers) { - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); for (Map.Entry entry : headers.entrySet()) { if (entry.getValue() != null) { map.put(entry.getKey(), entry.getValue()); @@ -44,7 +48,7 @@ class MessageHeadersSerializer extends Serializer { } @Override - public MessageHeaders read(Kryo kryo, Input input, Class type) { + public MessageHeaders read(Kryo kryo, Input input, Class type) { @SuppressWarnings("unchecked") Map headers = kryo.readObject(input, HashMap.class); return new MessageHeaders(headers); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/MutableMessageHeadersSerializer.java b/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/MutableMessageHeadersSerializer.java index f922be5183..5064e5fb9b 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/MutableMessageHeadersSerializer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/MutableMessageHeadersSerializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2019 the original author or authors. + * Copyright 2015-2022 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. @@ -27,13 +27,16 @@ import com.esotericsoftware.kryo.io.Input; /** * Kryo Serializer for {@link MutableMessageHeaders}. + * * @author David Turanski + * @author Artem Bilan + * * @since 4.2 */ class MutableMessageHeadersSerializer extends MessageHeadersSerializer { @Override - public MessageHeaders read(Kryo kryo, Input input, Class type) { + public MessageHeaders read(Kryo kryo, Input input, Class type) { @SuppressWarnings("unchecked") Map headers = kryo.readObject(input, HashMap.class); return new MutableMessageHeaders(headers); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/PojoCodec.java b/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/PojoCodec.java index 567b06bcd4..327633181d 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/PojoCodec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/PojoCodec.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2019 the original author or authors. + * Copyright 2015-2022 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. @@ -26,6 +26,7 @@ import org.springframework.util.CollectionUtils; import com.esotericsoftware.kryo.Kryo; import com.esotericsoftware.kryo.io.Input; import com.esotericsoftware.kryo.io.Output; +import com.esotericsoftware.kryo.util.DefaultInstantiatorStrategy; /** * Kryo Codec that can encode and decode arbitrary types. Classes and associated @@ -34,6 +35,7 @@ import com.esotericsoftware.kryo.io.Output; * * @author David Turanski * @author Artem Bilan + * * @since 4.2 */ public class PojoCodec extends AbstractKryoCodec { @@ -99,7 +101,7 @@ public class PojoCodec extends AbstractKryoCodec { @Override protected void configureKryoInstance(Kryo kryo) { - kryo.setInstantiatorStrategy(new Kryo.DefaultInstantiatorStrategy(new StdInstantiatorStrategy())); + kryo.setInstantiatorStrategy(new DefaultInstantiatorStrategy(new StdInstantiatorStrategy())); if (this.kryoRegistrar != null) { this.kryoRegistrar.registerTypes(kryo); } diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/outbound/CookieTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/outbound/CookieTests.java index b6c94eb283..0523de01a5 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/outbound/CookieTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/outbound/CookieTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2022 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. @@ -117,6 +117,7 @@ public class CookieTests { } @Override + @Deprecated public String getMethodValue() { return null; } diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcJavaConfigTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcJavaConfigTests.java index 219beab36b..8d2e769eb1 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcJavaConfigTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcJavaConfigTests.java @@ -26,7 +26,6 @@ import java.util.List; import javax.sql.DataSource; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -62,7 +61,6 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; */ @SpringJUnitConfig @DirtiesContext -@Disabled("H2 v2 is broken for stored procedures") public class StoredProcJavaConfigTests { @Autowired diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithNamespaceIntegrationTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithNamespaceIntegrationTests.java index 4142856091..bd1e922e6b 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithNamespaceIntegrationTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithNamespaceIntegrationTests.java @@ -26,7 +26,6 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -43,7 +42,6 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; */ @SpringJUnitConfig @DirtiesContext -@Disabled("H2 v2 is broken for stored procedures") public class StoredProcPollingChannelAdapterWithNamespaceIntegrationTests { @Autowired diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithSpringContextIntegrationTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithSpringContextIntegrationTests.java index 01abdeb8d2..0a856dccb3 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithSpringContextIntegrationTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithSpringContextIntegrationTests.java @@ -26,7 +26,6 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -42,7 +41,6 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; */ @SpringJUnitConfig @DirtiesContext -@Disabled("H2 v2 is broken for stored procedures") public class StoredProcPollingChannelAdapterWithSpringContextIntegrationTests { @Autowired