Adapt AMQP tests to latest Rabbit Streams Client

Related to https://github.com/spring-projects/spring-amqp/issues/2522

No need to use an `AddressResolver` with the latest RabbitMQ Streams Client library
The current configuration is reflecting whatever Spring Boot auto-configuration experience
would expect from us
This commit is contained in:
Artem Bilan
2023-11-06 15:14:52 -05:00
parent a8b9a3d844
commit 96adc08ad8
3 changed files with 3 additions and 6 deletions

View File

@@ -16,7 +16,6 @@
package org.springframework.integration.amqp.dsl;
import com.rabbitmq.stream.Address;
import com.rabbitmq.stream.Environment;
import org.junit.jupiter.api.Test;
@@ -103,7 +102,7 @@ public class RabbitStreamTests implements RabbitTestContainer {
@Bean
Environment rabbitStreamEnvironment() {
return Environment.builder()
.addressResolver(add -> new Address("localhost", RabbitTestContainer.streamPort()))
.port(RabbitTestContainer.streamPort())
.build();
}

View File

@@ -20,7 +20,6 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import com.rabbitmq.stream.Address;
import com.rabbitmq.stream.Consumer;
import com.rabbitmq.stream.Environment;
import com.rabbitmq.stream.OffsetSpecification;
@@ -46,7 +45,7 @@ public class RabbitStreamMessageHandlerTests implements RabbitTestContainer {
void convertAndSend() throws InterruptedException {
Environment env = Environment.builder()
.lazyInitialization(true)
.addressResolver(add -> new Address("localhost", RabbitTestContainer.streamPort()))
.port(RabbitTestContainer.streamPort())
.build();
try {
env.deleteStream("stream.stream");
@@ -83,7 +82,7 @@ public class RabbitStreamMessageHandlerTests implements RabbitTestContainer {
@Test
void sendNative() throws InterruptedException {
Environment env = Environment.builder()
.addressResolver(add -> new Address("localhost", RabbitTestContainer.streamPort()))
.port(RabbitTestContainer.streamPort())
.lazyInitialization(true)
.build();
try {

View File

@@ -35,7 +35,6 @@ public interface RabbitTestContainer {
RabbitMQContainer RABBITMQ = new RabbitMQContainer("rabbitmq:management")
.withExposedPorts(5672, 15672, 5552)
.withEnv("RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS", "-rabbitmq_stream advertised_host localhost")
.withStartupTimeout(Duration.ofMinutes(2));
@BeforeAll