Fix deprecation warnings in AMPQ module
* The `Confirm` in Spring AMQP is a `record` now, so not `isAck()` but just `ack()` * The `MessageBatch` in Spring AMQP is a `record` now, so not `getMessage()`, but just `message()` * Fix new deprecation warning for the `SingleRequestResponseScenarioTests`
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2023 the original author or authors.
|
||||
* Copyright 2017-2025 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.
|
||||
@@ -20,6 +20,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import org.aopalliance.aop.Advice;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.amqp.core.AcknowledgeMode;
|
||||
import org.springframework.amqp.core.MessagePostProcessor;
|
||||
@@ -55,7 +56,7 @@ public abstract class AbstractMessageListenerContainerSpec<S extends AbstractMes
|
||||
}
|
||||
|
||||
@Override
|
||||
public S id(String id) { // NOSONAR - not useless, increases visibility
|
||||
public S id(@Nullable String id) { // NOSONAR - not useless, increases visibility
|
||||
return super.id(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Provides AMQP Component support for the Java DSL.
|
||||
*/
|
||||
@org.springframework.lang.NonNullApi
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package org.springframework.integration.amqp.dsl;
|
||||
|
||||
@@ -208,7 +208,7 @@ public class AmqpOutboundEndpoint extends AbstractAmqpOutboundEndpoint
|
||||
try {
|
||||
Confirm confirm = correlationData.getFuture().get(this.waitForConfirmTimeout.toMillis(),
|
||||
TimeUnit.MILLISECONDS);
|
||||
if (!confirm.isAck()) {
|
||||
if (!confirm.ack()) {
|
||||
throw new AmqpException("Negative publisher confirm received: " + confirm);
|
||||
}
|
||||
if (correlationData.getReturned() != null) {
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
/**
|
||||
* Base package for AMQP support.
|
||||
*/
|
||||
@org.springframework.lang.NonNullApi
|
||||
package org.springframework.integration.amqp;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2024 the original author or authors.
|
||||
* Copyright 2013-2025 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.
|
||||
@@ -477,7 +477,7 @@ public class InboundEndpointTests {
|
||||
bs.addToBatch("foo", "bar", message);
|
||||
message = new org.springframework.amqp.core.Message("test2".getBytes(), messageProperties);
|
||||
MessageBatch batched = bs.addToBatch("foo", "bar", message);
|
||||
listener.onMessage(batched.getMessage(), null);
|
||||
listener.onMessage(batched.message(), null);
|
||||
Message<?> received = out.receive(0);
|
||||
assertThat(received).isNotNull();
|
||||
assertThat(((List<String>) received.getPayload())).contains("test1", "test2");
|
||||
@@ -503,12 +503,12 @@ public class InboundEndpointTests {
|
||||
bs.addToBatch("foo", "bar", message);
|
||||
message = new org.springframework.amqp.core.Message("test2".getBytes(), messageProperties);
|
||||
MessageBatch batched = bs.addToBatch("foo", "bar", message);
|
||||
listener.onMessage(batched.getMessage(), null);
|
||||
listener.onMessage(batched.message(), null);
|
||||
Message<?> received = out.receive(0);
|
||||
assertThat(received).isNotNull();
|
||||
assertThat(((List<String>) received.getPayload())).contains("test1", "test2");
|
||||
org.springframework.amqp.core.Message sourceData = StaticMessageHeaderAccessor.getSourceData(received);
|
||||
assertThat(sourceData).isSameAs(batched.getMessage());
|
||||
assertThat(sourceData).isSameAs(batched.message());
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2025 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.
|
||||
@@ -229,7 +229,7 @@ public class AmqpOutboundEndpointTests {
|
||||
assertThat(returned.getPayload()).isEqualTo(message.getPayload());
|
||||
Confirm confirm = corrData.getFuture().get(10, TimeUnit.SECONDS);
|
||||
assertThat(confirm).isNotNull();
|
||||
assertThat(confirm.isAck()).isTrue();
|
||||
assertThat(confirm.ack()).isTrue();
|
||||
assertThat(corrData.getReturned()).isNotNull();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019-2023 the original author or authors.
|
||||
* Copyright 2019-2025 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.
|
||||
@@ -84,7 +84,7 @@ public class AmqpOutboundEndpointTests2 {
|
||||
.setHeader("rk", "junkjunk")
|
||||
.setHeader(AmqpHeaders.PUBLISH_CONFIRM_CORRELATION, corr)
|
||||
.build());
|
||||
assertThat(corr.getFuture().get(10, TimeUnit.SECONDS).isAck()).isTrue();
|
||||
assertThat(corr.getFuture().get(10, TimeUnit.SECONDS).ack()).isTrue();
|
||||
assertThat(corr.getReturned()).isNotNull();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2022 the original author or authors.
|
||||
* Copyright 2016-2025 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.
|
||||
@@ -251,7 +251,7 @@ class AsyncAmqpGatewayTests {
|
||||
gateway.handleMessage(MessageBuilder.withPayload("test")
|
||||
.setHeader(AmqpHeaders.PUBLISH_CONFIRM_CORRELATION, corr)
|
||||
.build());
|
||||
assertThat(corr.getFuture().get(10, TimeUnit.SECONDS).isAck()).isTrue();
|
||||
assertThat(corr.getFuture().get(10, TimeUnit.SECONDS).ack()).isTrue();
|
||||
assertThat(corr.getReturned()).isNotNull();
|
||||
|
||||
asyncTemplate.stop();
|
||||
|
||||
@@ -47,6 +47,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
* @author Jiandong Ma
|
||||
*
|
||||
* @since 7.0
|
||||
*/
|
||||
@SpringJUnitConfig
|
||||
@DirtiesContext
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.junit.runners.model.Statement;
|
||||
import org.springframework.integration.test.condition.LongRunningTest;
|
||||
|
||||
/**
|
||||
* Rule to prevent long running tests from running on every build; set environment
|
||||
* Rule to prevent long-running tests from running on every build; set environment
|
||||
* variable RUN_LONG_INTEGRATION_TESTS on a CI nightly build to ensure coverage.
|
||||
*
|
||||
* @author Gary Russell
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.List;
|
||||
* @author David Turanski
|
||||
* @author Jiandong Ma
|
||||
*
|
||||
* @since 7.0
|
||||
*/
|
||||
public abstract class SingleRequestResponseScenarioTest extends AbstractRequestResponseScenarioTest {
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.util.List;
|
||||
* @deprecated since 7.0 in favor of {@link SingleRequestResponseScenarioTest}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public abstract class SingleRequestResponseScenarioTests extends AbstractRequestResponseScenarioTests {
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user