Upgrade dependencies; prepare for release
* Upgrade Gradle to `8.10.2` * Upgrade Antora extensions * Upgrade to the latest `spring-io/antora-ui-spring` * Upgrade MySQL connector-j to `9.1.0` * Some code modernization for the `TcpNioConnectionTests`
This commit is contained in:
20
build.gradle
20
build.gradle
@@ -89,32 +89,32 @@ ext {
|
||||
junitJupiterVersion = '5.11.3'
|
||||
kotlinCoroutinesVersion = '1.8.1'
|
||||
kryoVersion = '5.6.2'
|
||||
lettuceVersion = '6.5.0.RC2'
|
||||
lettuceVersion = '6.4.0.RELEASE'
|
||||
log4jVersion = '2.24.1'
|
||||
mailVersion = '2.0.3'
|
||||
micrometerTracingVersion = '1.4.0-SNAPSHOT'
|
||||
micrometerVersion = '1.14.0-SNAPSHOT'
|
||||
micrometerTracingVersion = '1.4.0-RC1'
|
||||
micrometerVersion = '1.14.0-RC1'
|
||||
mockitoVersion = '5.14.2'
|
||||
mongoDriverVersion = '5.2.0'
|
||||
mysqlVersion = '9.0.0'
|
||||
mysqlVersion = '9.1.0'
|
||||
oracleVersion = '23.5.0.24.07'
|
||||
pahoMqttClientVersion = '1.2.5'
|
||||
postgresVersion = '42.7.4'
|
||||
protobufVersion = '4.28.2'
|
||||
r2dbch2Version = '1.0.0.RELEASE'
|
||||
reactorVersion = '2024.0.0-SNAPSHOT'
|
||||
reactorVersion = '2024.0.0-RC1'
|
||||
resilience4jVersion = '2.2.0'
|
||||
romeToolsVersion = '2.1.0'
|
||||
rsocketVersion = '1.1.4'
|
||||
servletApiVersion = '6.0.0'
|
||||
smackVersion = '4.4.8'
|
||||
springAmqpVersion = '3.2.0-SNAPSHOT'
|
||||
springDataVersion = '2024.1.0-SNAPSHOT'
|
||||
springAmqpVersion = '3.2.0-RC1'
|
||||
springDataVersion = '2024.1.0-RC1'
|
||||
springGraphqlVersion = '1.3.3'
|
||||
springKafkaVersion = '3.3.0-SNAPSHOT'
|
||||
springKafkaVersion = '3.3.0-RC1'
|
||||
springRetryVersion = '2.0.10'
|
||||
springSecurityVersion = '6.4.0-SNAPSHOT'
|
||||
springVersion = '6.2.0-SNAPSHOT'
|
||||
springSecurityVersion = '6.4.0-RC1'
|
||||
springVersion = '6.2.0-RC2'
|
||||
springWsVersion = '4.0.11'
|
||||
testcontainersVersion = '1.20.3'
|
||||
tomcatVersion = '10.1.31'
|
||||
|
||||
@@ -14,10 +14,10 @@ antora {
|
||||
]
|
||||
dependencies = [
|
||||
'@antora/atlas-extension': '1.0.0-alpha.2',
|
||||
'@antora/collector-extension': '1.0.0-alpha.3',
|
||||
'@antora/collector-extension': '1.0.0-beta.3',
|
||||
'@asciidoctor/tabs': '1.0.0-beta.6',
|
||||
'@springio/antora-extensions': '1.8.1',
|
||||
'@springio/asciidoctor-extensions': '1.0.0-alpha.9',
|
||||
'@springio/antora-extensions': '1.14.2',
|
||||
'@springio/asciidoctor-extensions': '1.0.0-alpha.14',
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,7 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=1541fa36599e12857140465f3c91a97409b4512501c26f9631fb113e392c5bd1
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
|
||||
distributionSha256Sum=31c55713e40233a8303827ceb42ca48a47267a0ad4bab9177123121e71524c26
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.springframework.integration.ip.tcp.connection;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.ConnectException;
|
||||
import java.net.InetAddress;
|
||||
@@ -76,9 +77,12 @@ import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.messaging.support.ErrorMessage;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
import static org.awaitility.Awaitility.await;
|
||||
import static org.awaitility.Awaitility.with;
|
||||
@@ -125,10 +129,10 @@ public class TcpNioConnectionTests {
|
||||
s.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ReflectionUtils.rethrowRuntimeException(e);
|
||||
}
|
||||
});
|
||||
assertThat(latch.await(10000, TimeUnit.MILLISECONDS)).isTrue();
|
||||
assertThat(latch.await(30, TimeUnit.SECONDS)).isTrue();
|
||||
TcpNioClientConnectionFactory factory =
|
||||
new TcpNioClientConnectionFactory("localhost", serverSocket.get().getLocalPort());
|
||||
factory.setLookupHost(true);
|
||||
@@ -174,10 +178,10 @@ public class TcpNioConnectionTests {
|
||||
done.await(10, TimeUnit.SECONDS);
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ReflectionUtils.rethrowRuntimeException(e);
|
||||
}
|
||||
});
|
||||
assertThat(latch.await(10000, TimeUnit.MILLISECONDS)).isTrue();
|
||||
assertThat(latch.await(30, TimeUnit.SECONDS)).isTrue();
|
||||
TcpNioClientConnectionFactory factory = new TcpNioClientConnectionFactory("localhost",
|
||||
serverSocket.get().getLocalPort());
|
||||
factory.setApplicationEventPublisher(nullPublisher);
|
||||
@@ -215,10 +219,10 @@ public class TcpNioConnectionTests {
|
||||
readFully(socket.getInputStream(), b);
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ReflectionUtils.rethrowRuntimeException(e);
|
||||
}
|
||||
});
|
||||
assertThat(latch.await(10000, TimeUnit.MILLISECONDS)).isTrue();
|
||||
assertThat(latch.await(30, TimeUnit.SECONDS)).isTrue();
|
||||
TcpNioClientConnectionFactory factory = new TcpNioClientConnectionFactory("localhost",
|
||||
serverSocket.get().getLocalPort());
|
||||
factory.setApplicationEventPublisher(nullPublisher);
|
||||
@@ -231,10 +235,9 @@ public class TcpNioConnectionTests {
|
||||
connection.close();
|
||||
assertThat(!connection.isOpen()).isTrue();
|
||||
TestUtils.getPropertyValue(factory, "selector", Selector.class).wakeup();
|
||||
await().atMost(Duration.ofSeconds(10)).until(() -> connections.size() == 0);
|
||||
await().atMost(Duration.ofSeconds(10)).until(connections::isEmpty);
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fail("Unexpected exception " + e);
|
||||
}
|
||||
factory.stop();
|
||||
@@ -330,16 +333,12 @@ public class TcpNioConnectionTests {
|
||||
}
|
||||
return null;
|
||||
});
|
||||
try {
|
||||
Object o = future.get(10, TimeUnit.SECONDS);
|
||||
fail("Expected exception, got " + o);
|
||||
}
|
||||
catch (ExecutionException e) {
|
||||
assertThat(e.getCause().getMessage()).isEqualTo("Timed out waiting for buffer space");
|
||||
}
|
||||
finally {
|
||||
exec.shutdownNow();
|
||||
}
|
||||
|
||||
assertThatExceptionOfType(ExecutionException.class)
|
||||
.isThrownBy(() -> future.get(10, TimeUnit.SECONDS))
|
||||
.withStackTraceContaining("Timed out waiting for buffer space");
|
||||
|
||||
exec.shutdownNow();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -374,7 +373,6 @@ public class TcpNioConnectionTests {
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw (Exception) e.getCause();
|
||||
}
|
||||
return null;
|
||||
@@ -445,18 +443,13 @@ public class TcpNioConnectionTests {
|
||||
.getPropertyValue("channelInputStream");
|
||||
stream.write(ByteBuffer.wrap("foo".getBytes()));
|
||||
byte[] out = new byte[5];
|
||||
try {
|
||||
stream.read(out, 1, 5);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
}
|
||||
catch (IndexOutOfBoundsException e) {
|
||||
}
|
||||
try {
|
||||
stream.read(null, 1, 5);
|
||||
fail("Expected IllegalArgumentException");
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
}
|
||||
|
||||
assertThatExceptionOfType(IndexOutOfBoundsException.class)
|
||||
.isThrownBy(() -> stream.read(out, 1, 5));
|
||||
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> stream.read(null, 1, 5));
|
||||
|
||||
assertThat(stream.read(out, 0, 0)).isEqualTo(0);
|
||||
assertThat(stream.read(out)).isEqualTo(3);
|
||||
}
|
||||
@@ -476,7 +469,7 @@ public class TcpNioConnectionTests {
|
||||
stream.read(out);
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
latch.countDown();
|
||||
});
|
||||
@@ -514,16 +507,12 @@ public class TcpNioConnectionTests {
|
||||
SocketChannel outChannel = mock(SocketChannel.class);
|
||||
when(outChannel.socket()).thenReturn(outSocket);
|
||||
TcpNioConnection outboundConnection = new TcpNioConnection(outChannel, true, false, nullPublisher, null);
|
||||
doAnswer(new Answer<Object>() {
|
||||
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
ByteBuffer buff = invocation.getArgument(0);
|
||||
byte[] bytes = new byte[buff.limit()];
|
||||
buff.get(bytes);
|
||||
written.write(bytes);
|
||||
return null;
|
||||
}
|
||||
doAnswer(invocation -> {
|
||||
ByteBuffer buff = invocation.getArgument(0);
|
||||
byte[] bytes = new byte[buff.limit()];
|
||||
buff.get(bytes);
|
||||
written.write(bytes);
|
||||
return null;
|
||||
}).when(outChannel).write(any(ByteBuffer.class));
|
||||
|
||||
MapMessageConverter outConverter = new MapMessageConverter();
|
||||
@@ -539,14 +528,10 @@ public class TcpNioConnectionTests {
|
||||
|
||||
final AtomicReference<Message<?>> inboundMessage = new AtomicReference<Message<?>>();
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
TcpListener listener = new TcpListener() {
|
||||
|
||||
@Override
|
||||
public boolean onMessage(Message<?> message) {
|
||||
inboundMessage.set(message);
|
||||
latch.countDown();
|
||||
return false;
|
||||
}
|
||||
TcpListener listener = message1 -> {
|
||||
inboundMessage.set(message1);
|
||||
latch.countDown();
|
||||
return false;
|
||||
};
|
||||
inboundConnection.registerListener(listener);
|
||||
inboundConnection.readPacket();
|
||||
@@ -565,19 +550,14 @@ public class TcpNioConnectionTests {
|
||||
|
||||
factory.setSoTimeout(1000);
|
||||
factory.setTaskExecutor(compositeExec);
|
||||
final AtomicReference<String> threadName = new AtomicReference<String>();
|
||||
final AtomicReference<String> threadName = new AtomicReference<>();
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
factory.registerListener(new TcpListener() {
|
||||
|
||||
@Override
|
||||
public boolean onMessage(Message<?> message) {
|
||||
if (!(message instanceof ErrorMessage)) {
|
||||
threadName.set(Thread.currentThread().getName());
|
||||
latch.countDown();
|
||||
}
|
||||
return false;
|
||||
factory.registerListener(message -> {
|
||||
if (!(message instanceof ErrorMessage)) {
|
||||
threadName.set(Thread.currentThread().getName());
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
factory.start();
|
||||
TestingUtilities.waitListening(factory, null);
|
||||
@@ -598,7 +578,7 @@ public class TcpNioConnectionTests {
|
||||
socket.getOutputStream().write("foo\r\n".getBytes());
|
||||
socket.close();
|
||||
|
||||
assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue();
|
||||
assertThat(latch.await(30, TimeUnit.SECONDS)).isTrue();
|
||||
assertThat(threadName.get()).contains("assembler");
|
||||
|
||||
factory.stop();
|
||||
@@ -720,17 +700,12 @@ public class TcpNioConnectionTests {
|
||||
});
|
||||
final CountDownLatch assemblerLatch = new CountDownLatch(1);
|
||||
final AtomicReference<Thread> assembler = new AtomicReference<Thread>();
|
||||
factory.registerListener(new TcpListener() {
|
||||
|
||||
@Override
|
||||
public boolean onMessage(Message<?> message) {
|
||||
if (!(message instanceof ErrorMessage)) {
|
||||
assembler.set(Thread.currentThread());
|
||||
assemblerLatch.countDown();
|
||||
}
|
||||
return false;
|
||||
factory.registerListener(message -> {
|
||||
if (!(message instanceof ErrorMessage)) {
|
||||
assembler.set(Thread.currentThread());
|
||||
assemblerLatch.countDown();
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
ThreadPoolTaskExecutor te = new ThreadPoolTaskExecutor();
|
||||
te.setCorePoolSize(3); // selector, reader, assembler
|
||||
@@ -756,38 +731,26 @@ public class TcpNioConnectionTests {
|
||||
|
||||
final CountDownLatch readerLatch = new CountDownLatch(4); // 3 dataAvailable, 1 continuing
|
||||
final CountDownLatch readerFinishedLatch = new CountDownLatch(1);
|
||||
doAnswer(new Answer<Void>() {
|
||||
|
||||
@Override
|
||||
public Void answer(InvocationOnMock invocation) throws Throwable {
|
||||
invocation.callRealMethod();
|
||||
// delay the reader thread resetting writingToPipe
|
||||
readerLatch.await(10, TimeUnit.SECONDS);
|
||||
Thread.sleep(100);
|
||||
readerFinishedLatch.countDown();
|
||||
return null;
|
||||
}
|
||||
doAnswer(invocation -> {
|
||||
invocation.callRealMethod();
|
||||
// delay the reader thread resetting writingToPipe
|
||||
readerLatch.await(10, TimeUnit.SECONDS);
|
||||
Thread.sleep(100);
|
||||
readerFinishedLatch.countDown();
|
||||
return null;
|
||||
}).when(cis).write(any(ByteBuffer.class));
|
||||
|
||||
doReturn(true).when(logger).isTraceEnabled();
|
||||
doAnswer(new Answer<Void>() {
|
||||
|
||||
@Override
|
||||
public Void answer(InvocationOnMock invocation) throws Throwable {
|
||||
invocation.callRealMethod();
|
||||
readerLatch.countDown();
|
||||
return null;
|
||||
}
|
||||
doAnswer(invocation -> {
|
||||
invocation.callRealMethod();
|
||||
readerLatch.countDown();
|
||||
return null;
|
||||
}).when(logger).trace(contains("checking data avail"));
|
||||
|
||||
doAnswer(new Answer<Void>() {
|
||||
|
||||
@Override
|
||||
public Void answer(InvocationOnMock invocation) throws Throwable {
|
||||
invocation.callRealMethod();
|
||||
readerLatch.countDown();
|
||||
return null;
|
||||
}
|
||||
doAnswer(invocation -> {
|
||||
invocation.callRealMethod();
|
||||
readerLatch.countDown();
|
||||
return null;
|
||||
}).when(logger).trace(contains("Nio assembler continuing"));
|
||||
|
||||
socket.getOutputStream().write("foo\r\n".getBytes());
|
||||
|
||||
@@ -39,4 +39,4 @@ runtime:
|
||||
format: pretty
|
||||
ui:
|
||||
bundle:
|
||||
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.4.10/ui-bundle.zip
|
||||
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.4.17/ui-bundle.zip
|
||||
Reference in New Issue
Block a user