diff --git a/spring-amqp/src/main/java/org/springframework/amqp/core/AmqpMessageReturnedException.java b/spring-amqp/src/main/java/org/springframework/amqp/core/AmqpMessageReturnedException.java index 4cb71033..d831fef8 100644 --- a/spring-amqp/src/main/java/org/springframework/amqp/core/AmqpMessageReturnedException.java +++ b/spring-amqp/src/main/java/org/springframework/amqp/core/AmqpMessageReturnedException.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. @@ -32,13 +32,6 @@ public class AmqpMessageReturnedException extends AmqpException { private final ReturnedMessage returned; - @Deprecated - public AmqpMessageReturnedException(String message, Message returnedMessage, int replyCode, String replyText, - String exchange, String routingKey) { - - this(message, new ReturnedMessage(returnedMessage, replyCode, replyText, exchange, routingKey)); - } - public AmqpMessageReturnedException(String message, ReturnedMessage returned) { super(message); this.returned = returned; diff --git a/spring-amqp/src/main/java/org/springframework/amqp/core/Message.java b/spring-amqp/src/main/java/org/springframework/amqp/core/Message.java index 32682fb9..3cb48721 100644 --- a/spring-amqp/src/main/java/org/springframework/amqp/core/Message.java +++ b/spring-amqp/src/main/java/org/springframework/amqp/core/Message.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 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. @@ -74,16 +74,6 @@ public class Message implements Serializable { this.messageProperties = messageProperties; } - /** - * No longer used. - * @param patterns the patterns. - * @since 1.5.7 - * @deprecated toString() no longer deserializes the body. - */ - @Deprecated - public static void addAllowedListPatterns(String... patterns) { - } - /** * Set the encoding to use in {@link #toString()} when converting the body if * there is no {@link MessageProperties#getContentEncoding() contentEncoding} message property present. diff --git a/spring-amqp/src/main/java/org/springframework/amqp/core/Queue.java b/spring-amqp/src/main/java/org/springframework/amqp/core/Queue.java index 5cebaa19..3ce08b21 100644 --- a/spring-amqp/src/main/java/org/springframework/amqp/core/Queue.java +++ b/spring-amqp/src/main/java/org/springframework/amqp/core/Queue.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 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. @@ -32,14 +32,6 @@ import org.springframework.util.StringUtils; */ public class Queue extends AbstractDeclarable implements Cloneable { - /** - * Argument key for the master locator. - * @since 2.1 - * @deprecated in favor of {@link #X_QUEUE_LEADER_LOCATOR}. - */ - @Deprecated - public static final String X_QUEUE_MASTER_LOCATOR = "x-queue-master-locator"; - /** * Argument key for the queue leader locator. * @since 2.1 @@ -165,22 +157,6 @@ public class Queue extends AbstractDeclarable implements Cloneable { return this.actualName; } - /** - * Set the master locator strategy argument for this queue. - * @param locator the locator; null to clear the argument. - * @since 2.1 - * @deprecated in favor of {@link #setLeaderLocator(String)}. - */ - @Deprecated - public final void setMasterLocator(@Nullable String locator) { - if (locator == null) { - removeArgument(X_QUEUE_LEADER_LOCATOR); - } - else { - addArgument(X_QUEUE_LEADER_LOCATOR, locator); - } - } - /** * Set the leader locator strategy argument for this queue. * @param locator the locator; null to clear the argument. diff --git a/spring-amqp/src/main/java/org/springframework/amqp/core/QueueBuilder.java b/spring-amqp/src/main/java/org/springframework/amqp/core/QueueBuilder.java index f76bbdb9..0b99462d 100644 --- a/spring-amqp/src/main/java/org/springframework/amqp/core/QueueBuilder.java +++ b/spring-amqp/src/main/java/org/springframework/amqp/core/QueueBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 the original author or authors. + * Copyright 2016-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. @@ -223,20 +223,6 @@ public final class QueueBuilder extends AbstractBuilder { return withArgument("x-queue-mode", "lazy"); } - /** - * Set the master locator mode which determines which node a queue master will be - * located on a cluster of nodes. - * @param locator {@link MasterLocator#minMasters}, {@link MasterLocator#clientLocal} - * or {@link MasterLocator#random}. - * @return the builder. - * @since 2.2 - * @deprecated in favor of {@link #leaderLocator(LeaderLocator)}. - */ - @Deprecated - public QueueBuilder masterLocator(MasterLocator locator) { - return withArgument("x-queue-master-locator", locator.getValue()); - } - /** * Set the master locator mode which determines which node a queue master will be * located on a cluster of nodes. @@ -326,43 +312,6 @@ public final class QueueBuilder extends AbstractBuilder { } - /** - * @deprecated in favor of {@link LeaderLocator}. - */ - @Deprecated - public enum MasterLocator { - - /** - * Deploy on the node with the fewest masters. - */ - minMasters("min-masters"), - - /** - * Deploy on the node we are connected to. - */ - clientLocal("client-local"), - - /** - * Deploy on a random node. - */ - random("random"); - - private final String value; - - MasterLocator(String value) { - this.value = value; - } - - /** - * Return the value. - * @return the value. - */ - public String getValue() { - return this.value; - } - - } - /** * Locate the queue leader. * diff --git a/spring-rabbit-test/src/main/java/org/springframework/amqp/rabbit/test/mockito/LambdaAnswer.java b/spring-rabbit-test/src/main/java/org/springframework/amqp/rabbit/test/mockito/LambdaAnswer.java index 191fc447..33dbfee5 100644 --- a/spring-rabbit-test/src/main/java/org/springframework/amqp/rabbit/test/mockito/LambdaAnswer.java +++ b/spring-rabbit-test/src/main/java/org/springframework/amqp/rabbit/test/mockito/LambdaAnswer.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 the original author or authors. + * Copyright 2016-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. @@ -47,17 +47,6 @@ public class LambdaAnswer extends ForwardsInvocations { private final boolean hasDelegate; - /** - * Deprecated. - * @param callRealMethod true to call the real method. - * @param callback the callback. - * @deprecated in favor of {@link #LambdaAnswer(boolean, ValueToReturn, Object)}. - */ - @Deprecated - public LambdaAnswer(boolean callRealMethod, ValueToReturn callback) { - this(callRealMethod, callback, null); - } - /** * Construct an instance with the provided properties. Use the test harness to get an * instance with the proper delegate. diff --git a/spring-rabbit-test/src/main/java/org/springframework/amqp/rabbit/test/mockito/LatchCountDownAndCallRealMethodAnswer.java b/spring-rabbit-test/src/main/java/org/springframework/amqp/rabbit/test/mockito/LatchCountDownAndCallRealMethodAnswer.java index ae42862f..d4556937 100644 --- a/spring-rabbit-test/src/main/java/org/springframework/amqp/rabbit/test/mockito/LatchCountDownAndCallRealMethodAnswer.java +++ b/spring-rabbit-test/src/main/java/org/springframework/amqp/rabbit/test/mockito/LatchCountDownAndCallRealMethodAnswer.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 the original author or authors. + * Copyright 2016-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. @@ -46,17 +46,6 @@ public class LatchCountDownAndCallRealMethodAnswer extends ForwardsInvocations { private final boolean hasDelegate; - /** - * Get an instance with no delegate. - * @param count to set in a {@link CountDownLatch}. - * @deprecated in favor of - * {@link #LatchCountDownAndCallRealMethodAnswer(int, Object)}. - */ - @Deprecated - public LatchCountDownAndCallRealMethodAnswer(int count) { - this(count, null); - } - /** * Get an instance with the provided properties. Use the test harness to get an * instance with the proper delegate. diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactory.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactory.java index 78e6e5e9..6ac59839 100644 --- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactory.java +++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactory.java @@ -397,45 +397,6 @@ public class CachingConnectionFactory extends AbstractConnectionFactory } } - /** - * Use full (correlated) publisher confirms, with correlation data and a callback for - * each message. - * @param publisherConfirms true for full publisher returns, - * @since 1.1 - * @deprecated in favor of {@link #setPublisherConfirmType(ConfirmType)}. - * @see #setSimplePublisherConfirms(boolean) - */ - @Deprecated - public void setPublisherConfirms(boolean publisherConfirms) { - Assert.isTrue(!publisherConfirms || !ConfirmType.SIMPLE.equals(this.confirmType), - "Cannot set both publisherConfirms and simplePublisherConfirms"); - if (publisherConfirms) { - setPublisherConfirmType(ConfirmType.CORRELATED); - } - else if (this.confirmType.equals(ConfirmType.CORRELATED)) { - setPublisherConfirmType(ConfirmType.NONE); - } - } - - /** - * Use simple publisher confirms where the template simply waits for completion. - * @param simplePublisherConfirms true for confirms. - * @since 2.1 - * @deprecated in favor of {@link #setPublisherConfirmType(ConfirmType)}. - * @see #setPublisherConfirms(boolean) - */ - @Deprecated - public void setSimplePublisherConfirms(boolean simplePublisherConfirms) { - Assert.isTrue(!simplePublisherConfirms || !ConfirmType.CORRELATED.equals(this.confirmType), - "Cannot set both publisherConfirms and simplePublisherConfirms"); - if (simplePublisherConfirms) { - setPublisherConfirmType(ConfirmType.SIMPLE); - } - else if (this.confirmType.equals(ConfirmType.SIMPLE)) { - setPublisherConfirmType(ConfirmType.NONE); - } - } - @Override public boolean isSimplePublisherConfirms() { return this.confirmType.equals(ConfirmType.SIMPLE); diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/CorrelationData.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/CorrelationData.java index 46ffaedc..b6909d51 100644 --- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/CorrelationData.java +++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/CorrelationData.java @@ -20,7 +20,6 @@ import java.util.UUID; import java.util.concurrent.CompletableFuture; import org.springframework.amqp.core.Correlation; -import org.springframework.amqp.core.Message; import org.springframework.amqp.core.ReturnedMessage; import org.springframework.lang.Nullable; import org.springframework.util.Assert; @@ -99,44 +98,13 @@ public class CorrelationData implements Correlation { * Return a future to check the success/failure of the publish operation. * @return the future. * @since 2.4.7 - * @deprecated in favor of {@link #getFuture()}. + * @deprecated as of 3.0, in favor of {@link #getFuture()}. */ @Deprecated public CompletableFuture getCompletableFuture() { return this.future; } - /** - * Return a returned message, if any; requires a unique - * {@link #CorrelationData(String) id}. Guaranteed to be populated before the future - * is set. - * @return the message or null. - * @since 2.1 - * @deprecated in favor of {@link #getReturned()}. - */ - @Deprecated - @Nullable - public Message getReturnedMessage() { - if (this.returnedMessage == null) { - return null; - } - else { - return this.returnedMessage.getMessage(); - } - } - - /** - * Set a returned message for this correlation data. - * @param returnedMessage the returned message. - * @since 1.7.13 - * @deprecated in favor of {@link #setReturned(ReturnedMessage)}. - */ - @Deprecated - public void setReturnedMessage(Message returnedMessage) { - this.returnedMessage = new ReturnedMessage(returnedMessage, 0, "not available", "not available", - "not available"); - } - /** * Get the returned message and metadata, if any. Guaranteed to be populated before * the future is set. diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/PublisherCallbackChannel.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/PublisherCallbackChannel.java index e27eba72..7370d017 100644 --- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/PublisherCallbackChannel.java +++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/PublisherCallbackChannel.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 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. @@ -19,7 +19,6 @@ package org.springframework.amqp.rabbit.connection; import java.util.Collection; import java.util.function.Consumer; -import com.rabbitmq.client.AMQP; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Return; @@ -115,37 +114,11 @@ public interface PublisherCallbackChannel extends Channel { */ void handleConfirm(PendingConfirm pendingConfirm, boolean ack); - /** - * Handle a returned message. - * @param replyCode the reply code. - * @param replyText the reply text. - * @param exchange the exchange. - * @param routingKey the routing key. - * @param properties the message properties. - * @param body the message body. - * @deprecated in favor of {@link #handleReturn(Return)}. - */ - @Deprecated - default void handleReturn(int replyCode, - String replyText, - String exchange, - String routingKey, - AMQP.BasicProperties properties, - byte[] body) { - - throw new UnsupportedOperationException( - "This should never be called; please open a GitHub issue with a stack trace"); - } - /** * Handle a returned message. * @param returned the message and metadata. */ - @SuppressWarnings("deprecation") - default void handleReturn(Return returned) { - handleReturn(returned.getReplyCode(), returned.getReplyText(), returned.getExchange(), - returned.getRoutingKey(), returned.getProperties(), returned.getBody()); - } + void handleReturn(Return returned); /** * When called, this listener should remove all references to the diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitTemplate.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitTemplate.java index 31603093..aecc38de 100644 --- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitTemplate.java +++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitTemplate.java @@ -471,29 +471,7 @@ public class RabbitTemplate extends RabbitAccessor // NOSONAR type line count /** * Set a callback to receive returned messages. * @param returnCallback the callback. - * @deprecated in favor of {@link #setReturnsCallback(ReturnsCallback)}. */ - @Deprecated - public void setReturnCallback(ReturnCallback returnCallback) { - ReturnCallback delegate = this.returnsCallback == null ? null : this.returnsCallback.delegate(); - Assert.state(this.returnsCallback == null || delegate == null || delegate.equals(returnCallback), - "Only one ReturnCallback is supported by each RabbitTemplate"); - this.returnsCallback = new ReturnsCallback() { - - @Override - public void returnedMessage(ReturnedMessage returned) { - returnCallback.returnedMessage(returned.getMessage(), returned.getReplyCode(), returned.getReplyText(), - returned.getExchange(), returned.getRoutingKey()); - } - - @Override - public ReturnCallback delegate() { - return returnCallback; - } - - }; - } - public void setReturnsCallback(ReturnsCallback returnCallback) { Assert.state(this.returnsCallback == null || this.returnsCallback.equals(returnCallback), "Only one ReturnCallback is supported by each RabbitTemplate"); @@ -2584,18 +2562,6 @@ public class RabbitTemplate extends RabbitAccessor // NOSONAR type line count } } - @Override - @SuppressWarnings("deprecation") - public void handleReturn(int replyCode, - String replyText, - String exchange, - String routingKey, - BasicProperties properties, - byte[] body) { - - handleReturn(new Return(replyCode, replyText, exchange, routingKey, properties, body)); - } - @Override public void handleReturn(Return returned) { ReturnsCallback callback = this.returnsCallback; @@ -2683,17 +2649,6 @@ public class RabbitTemplate extends RabbitAccessor // NOSONAR type line count } } - /** - * {@inheritDoc} - * - * @deprecated - use {@link #onMessage(Message, Channel)}. - */ - @Deprecated - @Override - public void onMessage(Message message) { - onMessage(message, null); - } - private void restoreProperties(Message message, PendingReply pendingReply) { if (!this.userCorrelationId) { // Restore the inbound correlation data @@ -2854,82 +2809,20 @@ public class RabbitTemplate extends RabbitAccessor // NOSONAR type line count } - /** - * A callback for returned messages. - * - * @deprecated in favor of {@link #returnedMessage(ReturnedMessage)} which is - * easier to use with lambdas. - */ - @Deprecated - @FunctionalInterface - public interface ReturnCallback { - - /** - * Returned message callback. - * @param message the returned message. - * @param replyCode the reply code. - * @param replyText the reply text. - * @param exchange the exchange. - * @param routingKey the routing key. - */ - void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey); - - /** - * Returned message callback. - * @param returned the returned message and metadata. - */ - @SuppressWarnings("deprecation") - default void returnedMessage(ReturnedMessage returned) { - returnedMessage(returned.getMessage(), returned.getReplyCode(), returned.getReplyText(), - returned.getExchange(), returned.getRoutingKey()); - } - - } - /** * A callback for returned messages. * * @since 2.3 */ @FunctionalInterface - public interface ReturnsCallback extends ReturnCallback { - - /** - * Returned message callback. - * @param message the returned message. - * @param replyCode the reply code. - * @param replyText the reply text. - * @param exchange the exchange. - * @param routingKey the routing key. - * @deprecated in favor of {@link #returnedMessage(ReturnedMessage)} which is - * easier to use with lambdas. - */ - @Override - @Deprecated - default void returnedMessage(Message message, int replyCode, String replyText, String exchange, - String routingKey) { - - throw new UnsupportedOperationException( - "This should never be called, please open a GitHub issue with a stack trace"); - }; + public interface ReturnsCallback { /** * Returned message callback. * @param returned the returned message and metadata. */ - @Override void returnedMessage(ReturnedMessage returned); - /** - * Internal use only; transitional during deprecation. - * @return the legacy delegate. - * @deprecated - will be removed with {@link ReturnCallback}. - */ - @Deprecated - @Nullable - default ReturnCallback delegate() { - return null; - } - } + } diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/MultiMethodRabbitListenerEndpoint.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/MultiMethodRabbitListenerEndpoint.java index 8a57710a..2f5ebbd8 100644 --- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/MultiMethodRabbitListenerEndpoint.java +++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/MultiMethodRabbitListenerEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2021 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. @@ -40,17 +40,6 @@ public class MultiMethodRabbitListenerEndpoint extends MethodRabbitListenerEndpo private Validator validator; - /** - * Construct an instance for the provided methods and bean. - * @param methods the methods. - * @param bean the bean. - * @deprecated - no longer used. - */ - @Deprecated - public MultiMethodRabbitListenerEndpoint(List methods, Object bean) { - this(methods, null, bean); - } - /** * Construct an instance for the provided methods, default method and bean. * @param methods the methods. diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/retry/RepublishMessageRecovererWithConfirms.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/retry/RepublishMessageRecovererWithConfirms.java index cbdd107b..65701c0c 100644 --- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/retry/RepublishMessageRecovererWithConfirms.java +++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/retry/RepublishMessageRecovererWithConfirms.java @@ -108,7 +108,6 @@ public class RepublishMessageRecovererWithConfirms extends RepublishMessageRecov } } - @SuppressWarnings("deprecation") private void doSendCorrelated(String exchange, String routingKey, Message message) { CorrelationData cd = new CorrelationData(); if (exchange != null) { diff --git a/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/connection/PublisherCallbackChannelTests.java b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/connection/PublisherCallbackChannelTests.java index e738a594..6dcd35b9 100644 --- a/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/connection/PublisherCallbackChannelTests.java +++ b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/connection/PublisherCallbackChannelTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 the original author or authors. + * Copyright 2019-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. @@ -64,11 +64,10 @@ import com.rabbitmq.client.ShutdownSignalException; @RabbitAvailable public class PublisherCallbackChannelTests { - @SuppressWarnings("deprecation") @Test void correlationData() { CorrelationData cd = new CorrelationData(); - assertThat(cd.getReturnedMessage()).isNull(); + assertThat(cd.getReturned()).isNull(); } @Test diff --git a/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/core/RabbitTemplateTests.java b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/core/RabbitTemplateTests.java index 0c36a162..7951a406 100644 --- a/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/core/RabbitTemplateTests.java +++ b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/core/RabbitTemplateTests.java @@ -61,7 +61,6 @@ import org.springframework.amqp.core.MessagePostProcessor; import org.springframework.amqp.core.MessageProperties; import org.springframework.amqp.core.Queue; import org.springframework.amqp.core.ReceiveAndReplyCallback; -import org.springframework.amqp.core.ReturnedMessage; import org.springframework.amqp.rabbit.connection.AbstractRoutingConnectionFactory; import org.springframework.amqp.rabbit.connection.AfterCompletionFailedException; import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; @@ -71,7 +70,6 @@ import org.springframework.amqp.rabbit.connection.PublisherCallbackChannel; import org.springframework.amqp.rabbit.connection.RabbitUtils; import org.springframework.amqp.rabbit.connection.SimpleRoutingConnectionFactory; import org.springframework.amqp.rabbit.connection.SingleConnectionFactory; -import org.springframework.amqp.rabbit.core.RabbitTemplate.ReturnsCallback; import org.springframework.amqp.rabbit.transaction.RabbitTransactionManager; import org.springframework.amqp.support.converter.SimpleMessageConverter; import org.springframework.amqp.utils.SerializationUtils; @@ -580,26 +578,6 @@ public class RabbitTemplateTests { verify(conn).createChannel(true); } - @SuppressWarnings("deprecation") - @Test - public void testReturnsFallback() { - RabbitTemplate template = new RabbitTemplate(); - AtomicBoolean called = new AtomicBoolean(); - template.setReturnCallback((message, replyCode, replyText, exchange, routingKey) -> { - called.set(true); - }); - ReturnsCallback cb = TestUtils.getPropertyValue(template, "returnsCallback", ReturnsCallback.class); - cb.returnedMessage(new ReturnedMessage(null, 0, null, null, null)); - assertThat(called.get()).isTrue(); - assertThatIllegalStateException().isThrownBy(() -> - template.setReturnCallback(mock(RabbitTemplate.ReturnCallback.class))); - RabbitTemplate template2 = new RabbitTemplate(); - org.springframework.amqp.rabbit.core.RabbitTemplate.ReturnCallback callback = - mock(org.springframework.amqp.rabbit.core.RabbitTemplate.ReturnCallback.class); - template2.setReturnCallback(callback); - template2.setReturnCallback(callback); - } - @Test void resourcesClearedAfterTxFails() throws IOException, TimeoutException { ConnectionFactory mockConnectionFactory = mock(ConnectionFactory.class);