From e4caeb17cb31ab9deecc6f2afeb6a31d52219ca9 Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Wed, 6 Sep 2023 13:39:54 -0700 Subject: [PATCH] Main to 3.1; Upgrade Dependency Versions Also compatibility changes for Mockito 5. * Upgrade Kotlin; fix test parameter names. --- build.gradle | 34 +++++++++---------- gradle.properties | 2 +- .../amqp/rabbit/AsyncRabbitTemplateTests.java | 11 ++++-- .../EnableRabbitIntegrationTests.java | 16 +++++---- .../MethodRabbitListenerEndpointTests.java | 4 +-- .../annotation-driven-full-config.xml | 2 +- ...tation-driven-full-configurable-config.xml | 2 +- .../annotation-driven-sample-config.xml | 2 +- .../ConnectionFactoryParserTests-context.xml | 3 +- .../config/ExchangeParserTests-context.xml | 3 +- .../QueueParserPlaceholderTests-context.xml | 3 +- .../config/QueueParserTests-context.xml | 3 +- .../config/TemplateParserTests-context.xml | 8 +++-- 13 files changed, 54 insertions(+), 39 deletions(-) diff --git a/build.gradle b/build.gradle index a823c54a..5bf63308 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlinVersion = '1.7.0' + ext.kotlinVersion = '1.9.10' ext.isCI = System.getenv('GITHUB_ACTION') || System.getenv('bamboo_buildKey') repositories { mavenCentral() @@ -42,7 +42,7 @@ ext { modifiedFiles = files(grgit.status().unstaged.modified).filter{ f -> f.name.endsWith('.java') || f.name.endsWith('.kt') } - assertjVersion = '3.23.1' + assertjVersion = '3.24.2' assertkVersion = '0.24' awaitilityVersion = '4.2.0' commonsCompressVersion = '1.20' @@ -51,26 +51,26 @@ ext { googleJsr305Version = '3.0.2' hamcrestVersion = '2.2' hibernateValidationVersion = '8.0.0.Final' - jacksonBomVersion = '2.14.2' - jaywayJsonPathVersion = '2.7.0' + jacksonBomVersion = '2.15.2' + jaywayJsonPathVersion = '2.8.0' junit4Version = '4.13.2' - junitJupiterVersion = '5.9.2' - kotlinCoroutinesVersion = '1.6.4' - log4jVersion = '2.19.0' - logbackVersion = '1.4.4' + junitJupiterVersion = '5.10.0' + kotlinCoroutinesVersion = '1.7.3' + log4jVersion = '2.20.0' + logbackVersion = '1.4.11' lz4Version = '1.8.0' micrometerDocsVersion = '1.0.2' - micrometerVersion = '1.10.10' - micrometerTracingVersion = '1.0.9' - mockitoVersion = '4.8.1' - rabbitmqStreamVersion = '0.8.0' - rabbitmqVersion = project.hasProperty('rabbitmqVersion') ? project.rabbitmqVersion : '5.16.1' - reactorVersion = '2022.0.10' + micrometerVersion = '1.12.0-SNAPSHOT' + micrometerTracingVersion = '1.2.0-SNAPSHOT' + mockitoVersion = '5.5.0' + rabbitmqStreamVersion = '0.12.0' + rabbitmqVersion = project.hasProperty('rabbitmqVersion') ? project.rabbitmqVersion : '5.18.0' + reactorVersion = '2023.0.0-SNAPSHOT' snappyVersion = '1.1.8.4' - springDataVersion = '2022.0.8' + springDataVersion = '2023.1.0-SNAPSHOT' springRetryVersion = '2.0.2' - springVersion = project.hasProperty('springVersion') ? project.springVersion : '6.0.11' - testcontainersVersion = '1.17.6' + springVersion = project.hasProperty('springVersion') ? project.springVersion : '6.1.0-SNAPSHOT' + testcontainersVersion = '1.19.0' zstdJniVersion = '1.5.0-2' javaProjects = subprojects - project(':spring-amqp-bom') diff --git a/gradle.properties b/gradle.properties index f770ff9c..773310c3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=3.0.9-SNAPSHOT +version=3.1.0-SNAPSHOT org.gradle.jvmargs=-Xms512m -Xmx4g -Dfile.encoding=UTF-8 org.gradle.daemon=true org.gradle.caching=true diff --git a/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/AsyncRabbitTemplateTests.java b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/AsyncRabbitTemplateTests.java index 039355ec..b8a925f4 100644 --- a/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/AsyncRabbitTemplateTests.java +++ b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/AsyncRabbitTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2022 the original author or authors. + * Copyright 2016-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. @@ -56,6 +56,7 @@ import org.springframework.amqp.support.postprocessor.GUnzipPostProcessor; import org.springframework.amqp.support.postprocessor.GZipPostProcessor; import org.springframework.amqp.utils.test.TestUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; @@ -528,12 +529,16 @@ public class AsyncRabbitTemplateTests { } @Bean - public AsyncRabbitTemplate asyncTemplate(RabbitTemplate template, SimpleMessageListenerContainer container) { + public AsyncRabbitTemplate asyncTemplate(@Qualifier("template") RabbitTemplate template, + SimpleMessageListenerContainer container) { + return new AsyncRabbitTemplate(template, container); } @Bean - public AsyncRabbitTemplate asyncDirectTemplate(RabbitTemplate templateForDirect) { + public AsyncRabbitTemplate asyncDirectTemplate( + @Qualifier("templateForDirect") RabbitTemplate templateForDirect) { + return new AsyncRabbitTemplate(templateForDirect); } diff --git a/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/annotation/EnableRabbitIntegrationTests.java b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/annotation/EnableRabbitIntegrationTests.java index 59808981..41a794f0 100644 --- a/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/annotation/EnableRabbitIntegrationTests.java +++ b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/annotation/EnableRabbitIntegrationTests.java @@ -107,6 +107,7 @@ import org.springframework.beans.DirectFieldAccessor; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.ApplicationContext; @@ -409,7 +410,7 @@ public class EnableRabbitIntegrationTests extends NeedsManagementTests { this.rabbitTemplate.setAfterReceivePostProcessors(mpp); assertThat(rabbitTemplate.convertSendAndReceive("multi.exch", "multi.rk", qux)).isEqualTo("QUX: qux: multi.rk"); assertThat(beanMethodHeaders).hasSize(2); - assertThat(beanMethodHeaders.get(0)).contains("$MultiListenerBean"); + assertThat(beanMethodHeaders.get(0)).contains("MultiListenerBean"); assertThat(beanMethodHeaders.get(1)).isEqualTo("qux"); this.rabbitTemplate.removeAfterReceivePostProcessor(mpp); assertThat(rabbitTemplate.convertSendAndReceive("multi.exch.tx", "multi.rk.tx", bar)).isEqualTo("BAR: barbar"); @@ -1203,7 +1204,7 @@ public class EnableRabbitIntegrationTests extends NeedsManagementTests { } @RabbitListener(queues = "test.header", group = "testGroup", replyPostProcessor = "#{'echoPrefixHeader'}") - public String capitalizeWithHeader(@Payload String content, @Header String prefix) { + public String capitalizeWithHeader(@Payload String content, @Header("prefix") String prefix) { return prefix + content.toUpperCase(); } @@ -1213,7 +1214,7 @@ public class EnableRabbitIntegrationTests extends NeedsManagementTests { } @RabbitListener(queues = "test.reply") - public org.springframework.messaging.Message reply(String payload, @Header String foo, + public org.springframework.messaging.Message reply(String payload, @Header("foo") String foo, @Header(AmqpHeaders.CONSUMER_TAG) String tag) { return MessageBuilder.withPayload(payload) .setHeader("foo", foo).setHeader("bar", tag).build(); @@ -1677,7 +1678,9 @@ public class EnableRabbitIntegrationTests extends NeedsManagementTests { @Bean public SimpleMessageListenerContainer factoryCreatedContainerSimpleListener( + @Qualifier("rabbitListenerContainerFactory") SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory) { + SimpleRabbitListenerEndpoint listener = new SimpleRabbitListenerEndpoint(); listener.setQueueNames("test.manual.container"); listener.setMessageListener((ChannelAwareMessageListener) (message, channel) -> { @@ -1689,6 +1692,7 @@ public class EnableRabbitIntegrationTests extends NeedsManagementTests { @Bean public SimpleMessageListenerContainer factoryCreatedContainerNoListener( + @Qualifier("rabbitListenerContainerFactory") SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory) { SimpleMessageListenerContainer container = rabbitListenerContainerFactory.createListenerContainer(); container.setMessageListener(message -> { @@ -1701,7 +1705,7 @@ public class EnableRabbitIntegrationTests extends NeedsManagementTests { @Bean public SimpleRabbitListenerContainerFactory rabbitAutoStartFalseListenerContainerFactory( - ReplyPostProcessor rpp) { + @Qualifier("rpp") ReplyPostProcessor rpp) { SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory(); factory.setConnectionFactory(rabbitConnectionFactory()); @@ -2466,14 +2470,14 @@ public class EnableRabbitIntegrationTests extends NeedsManagementTests { @RabbitListener(queues = "test.converted.foomessage") public String messagingMessage(org.springframework.messaging.Message message, - @Header(value = "", required = false) String h, + @Header(value = "notPresent", required = false) String h, @Header(name = AmqpHeaders.RECEIVED_USER_ID) String userId) { return message.getClass().getSimpleName() + message.getPayload().getClass().getSimpleName() + userId; } @RabbitListener(queues = "test.notconverted.messagingmessagenotgeneric") public String messagingMessage(@SuppressWarnings("rawtypes") org.springframework.messaging.Message message, - @Header(value = "", required = false) Integer h) { + @Header(value = "notPresent", required = false) Integer h) { return message.getClass().getSimpleName() + message.getPayload().getClass().getSimpleName(); } diff --git a/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/listener/MethodRabbitListenerEndpointTests.java b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/listener/MethodRabbitListenerEndpointTests.java index 24463d19..87d4dbff 100644 --- a/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/listener/MethodRabbitListenerEndpointTests.java +++ b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/listener/MethodRabbitListenerEndpointTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-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. @@ -465,7 +465,7 @@ public class MethodRabbitListenerEndpointTests { assertThat(message.getPayload()).as("Wrong message payload").isEqualTo("test"); } - public void resolveHeaderAndPayload(@Payload String content, @Header int myCounter, + public void resolveHeaderAndPayload(@Payload String content, @Header("myCounter") int myCounter, @Header(AmqpHeaders.CONSUMER_TAG) String tag, @Header(AmqpHeaders.CONSUMER_QUEUE) String queue) { invocations.put("resolveHeaderAndPayload", true); diff --git a/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/annotation/annotation-driven-full-config.xml b/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/annotation/annotation-driven-full-config.xml index 237a528c..a4993af9 100644 --- a/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/annotation/annotation-driven-full-config.xml +++ b/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/annotation/annotation-driven-full-config.xml @@ -14,7 +14,7 @@ - + diff --git a/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/annotation/annotation-driven-full-configurable-config.xml b/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/annotation/annotation-driven-full-configurable-config.xml index 21cc8555..c4d53363 100644 --- a/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/annotation/annotation-driven-full-configurable-config.xml +++ b/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/annotation/annotation-driven-full-configurable-config.xml @@ -17,7 +17,7 @@ - + - + diff --git a/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/ConnectionFactoryParserTests-context.xml b/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/ConnectionFactoryParserTests-context.xml index 4ae8d756..b4710462 100644 --- a/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/ConnectionFactoryParserTests-context.xml +++ b/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/ConnectionFactoryParserTests-context.xml @@ -15,7 +15,8 @@ connection-name-strategy="connectionNameStrategy"/> - + diff --git a/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/ExchangeParserTests-context.xml b/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/ExchangeParserTests-context.xml index 616f6323..a2004ce3 100644 --- a/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/ExchangeParserTests-context.xml +++ b/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/ExchangeParserTests-context.xml @@ -51,7 +51,8 @@ - + diff --git a/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/QueueParserPlaceholderTests-context.xml b/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/QueueParserPlaceholderTests-context.xml index f90c9553..41a47bfe 100644 --- a/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/QueueParserPlaceholderTests-context.xml +++ b/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/QueueParserPlaceholderTests-context.xml @@ -87,7 +87,8 @@ - + diff --git a/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/QueueParserTests-context.xml b/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/QueueParserTests-context.xml index 676c05ef..4923ec7c 100644 --- a/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/QueueParserTests-context.xml +++ b/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/QueueParserTests-context.xml @@ -75,7 +75,8 @@ - + diff --git a/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/TemplateParserTests-context.xml b/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/TemplateParserTests-context.xml index cbc799a6..26b70d6d 100644 --- a/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/TemplateParserTests-context.xml +++ b/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/TemplateParserTests-context.xml @@ -42,17 +42,19 @@ receive-connection-factory-selector-expression="'foo'"/> - + - + - +