From 60256c2ac692182b00579bdb8ee1f35f961d3a70 Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Wed, 6 Sep 2023 15:03:07 -0400 Subject: [PATCH 1/2] Main to 3.1; Upgrade Dependency Versions Also compatibility changes for Mockito 5. --- build.gradle | 32 +++++++++---------- gradle.properties | 2 +- .../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 +++-- 11 files changed, 35 insertions(+), 29 deletions(-) diff --git a/build.gradle b/build.gradle index a823c54a25..b9c2f02ff8 100644 --- a/build.gradle +++ b/build.gradle @@ -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 f770ff9cce..773310c3ba 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/listener/MethodRabbitListenerEndpointTests.java b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/listener/MethodRabbitListenerEndpointTests.java index 24463d19a3..87d4dbff83 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 void resolveGenericMessage(Message message) { 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 237a528ca1..a4993af914 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 21cc8555a3..c4d5336307 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 4ae8d756dc..b471046269 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 616f63239f..a2004ce3c4 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 f90c955380..41a47bfe93 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 676c05ef0e..4923ec7cfc 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 cbc799a662..26b70d6de7 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'"/> - + - + - + From 6668fac755d7af066f827f7b118d959042ba33a0 Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Wed, 6 Sep 2023 16:23:07 -0400 Subject: [PATCH 2/2] Upgrade Kotlin; fix test parameter names. --- build.gradle | 2 +- .../amqp/rabbit/AsyncRabbitTemplateTests.java | 11 ++++++++--- .../annotation/EnableRabbitIntegrationTests.java | 16 ++++++++++------ 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index b9c2f02ff8..5bf6330856 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() 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 039355ecea..b8a925f43d 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.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 SimpleMessageListenerContainer replyContainer(ConnectionFactory connectio } @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 59808981ba..41a794f036 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.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 void multiListener() { 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 String multiQueuesConfig(String foo) { } @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 String capitalizeWithMessage(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 SimpleRabbitListenerContainerFactory txListenerContainerFactory() { @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 SimpleMessageListenerContainer factoryCreatedContainerSimpleListener( @Bean public SimpleMessageListenerContainer factoryCreatedContainerNoListener( + @Qualifier("rabbitListenerContainerFactory") SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory) { SimpleMessageListenerContainer container = rabbitListenerContainerFactory.createListenerContainer(); container.setMessageListener(message -> { @@ -1701,7 +1705,7 @@ public SimpleMessageListenerContainer factoryCreatedContainerNoListener( @Bean public SimpleRabbitListenerContainerFactory rabbitAutoStartFalseListenerContainerFactory( - ReplyPostProcessor rpp) { + @Qualifier("rpp") ReplyPostProcessor rpp) { SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory(); factory.setConnectionFactory(rabbitConnectionFactory()); @@ -2466,14 +2470,14 @@ public String messagingMessage(org.springframework.messaging.Message message) @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(); }