diff --git a/pom.xml b/pom.xml
index 398d45fef..4064e23b6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -80,13 +80,6 @@
true
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
- true
-
-
diff --git a/spring-cloud-stream-binder-rabbit-test-support/pom.xml b/spring-cloud-stream-binder-rabbit-test-support/pom.xml
index 1e271358b..98935a875 100644
--- a/spring-cloud-stream-binder-rabbit-test-support/pom.xml
+++ b/spring-cloud-stream-binder-rabbit-test-support/pom.xml
@@ -9,11 +9,6 @@
spring-cloud-stream-binder-rabbit-test-support
Rabbit related test classes
-
- junit
- junit
- compile
-
org.springframework.cloud
spring-cloud-stream-test-support-internal
diff --git a/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/LocalizedQueueConnectionFactoryIntegrationTests.java b/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/LocalizedQueueConnectionFactoryIntegrationTests.java
index 4a871dc3a..acb13785c 100644
--- a/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/LocalizedQueueConnectionFactoryIntegrationTests.java
+++ b/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/LocalizedQueueConnectionFactoryIntegrationTests.java
@@ -18,9 +18,9 @@ package org.springframework.cloud.stream.binder.rabbit;
import java.util.UUID;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
@@ -37,12 +37,12 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
public class LocalizedQueueConnectionFactoryIntegrationTests {
- @ClassRule
+ @RegisterExtension
public static RabbitTestSupport rabbitAvailableRule = new RabbitTestSupport(true);
private LocalizedQueueConnectionFactory lqcf;
- @Before
+ @BeforeEach
public void setup() {
ConnectionFactory defaultConnectionFactory = rabbitAvailableRule.getResource();
String[] addresses = new String[] { "localhost:9999", "localhost:5672" };
diff --git a/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/RabbitBinderCleanerTests.java b/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/RabbitBinderCleanerTests.java
index 61abd19a8..dc5e5cf7e 100644
--- a/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/RabbitBinderCleanerTests.java
+++ b/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/RabbitBinderCleanerTests.java
@@ -27,8 +27,8 @@ import com.rabbitmq.client.Channel;
import com.rabbitmq.client.DefaultConsumer;
import com.rabbitmq.http.client.Client;
import com.rabbitmq.http.client.domain.QueueInfo;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
import org.springframework.amqp.core.Base64UrlNamingStrategy;
import org.springframework.amqp.core.BindingBuilder;
@@ -65,7 +65,7 @@ public class RabbitBinderCleanerTests {
}
}
- @Rule
+ @RegisterExtension
public RabbitTestSupport rabbitWithMgmtEnabled = new RabbitTestSupport(true);
@Test
diff --git a/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/RabbitBinderTests.java b/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/RabbitBinderTests.java
index 146e1a599..3ecc5b6e7 100644
--- a/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/RabbitBinderTests.java
+++ b/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/RabbitBinderTests.java
@@ -44,9 +44,9 @@ import com.rabbitmq.http.client.domain.BindingInfo;
import com.rabbitmq.http.client.domain.ExchangeInfo;
import com.rabbitmq.http.client.domain.QueueInfo;
import org.apache.commons.logging.Log;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.extension.RegisterExtension;
import org.mockito.ArgumentCaptor;
import org.springframework.amqp.AmqpIOException;
@@ -160,11 +160,9 @@ public class RabbitBinderTests extends
private int maxStackTraceSize;
- @Rule
- public RabbitTestSupport rabbitAvailableRule = new RabbitTestSupport(true);
- @Rule
- public TestName testName = new TestName();
+ @RegisterExtension
+ RabbitTestSupport rabbitAvailableRule = new RabbitTestSupport(true);
@Override
protected RabbitTestBinder getBinder() {
@@ -181,10 +179,11 @@ public class RabbitBinderTests extends
}
@Override
- protected ExtendedProducerProperties createProducerProperties() {
+ protected ExtendedProducerProperties createProducerProperties(TestInfo testInfo) {
ExtendedProducerProperties props = new ExtendedProducerProperties<>(
new RabbitProducerProperties());
- if (testName.getMethodName().equals("testPartitionedModuleSpEL")) {
+
+ if (testInfo.getTestMethod().get().getName().equals("testPartitionedModuleSpEL")) {
props.getExtension().setRoutingKeyExpression(
spelExpressionParser.parseExpression("'part.0'"));
}
@@ -197,7 +196,7 @@ public class RabbitBinderTests extends
}
@Test
- public void testSendAndReceiveBad() throws Exception {
+ public void testSendAndReceiveBad(TestInfo testInfo) throws Exception {
RabbitTestBinder binder = getBinder();
final AtomicReference event = new AtomicReference<>();
binder.getApplicationContext().addApplicationListener(
@@ -207,7 +206,7 @@ public class RabbitBinderTests extends
DirectChannel moduleInputChannel = createBindableChannel("input",
new BindingProperties());
Binding producerBinding = binder.bindProducer("bad.0",
- moduleOutputChannel, createProducerProperties());
+ moduleOutputChannel, createProducerProperties(testInfo));
assertThat(TestUtils.getPropertyValue(producerBinding,
"lifecycle.headersMappedLast", Boolean.class)).isTrue();
assertThat(
@@ -244,7 +243,7 @@ public class RabbitBinderTests extends
}
@Test
- public void testProducerErrorChannel() throws Exception {
+ public void testProducerErrorChannel(TestInfo testInfo) throws Exception {
RabbitTestBinder binder = getBinder();
CachingConnectionFactory ccf = this.rabbitAvailableRule.getResource();
ccf.setPublisherReturns(true);
@@ -252,7 +251,7 @@ public class RabbitBinderTests extends
ccf.resetConnection();
DirectChannel moduleOutputChannel = createBindableChannel("output",
new BindingProperties());
- ExtendedProducerProperties producerProps = createProducerProperties();
+ ExtendedProducerProperties producerProps = createProducerProperties(testInfo);
producerProps.setErrorChannelEnabled(true);
Binding producerBinding = binder.bindProducer("ec.0",
moduleOutputChannel, producerProps);
@@ -325,7 +324,7 @@ public class RabbitBinderTests extends
}
@Test
- public void testProducerAckChannel() throws Exception {
+ public void testProducerAckChannel(TestInfo testInfo) throws Exception {
RabbitTestBinder binder = getBinder();
CachingConnectionFactory ccf = this.rabbitAvailableRule.getResource();
ccf.setPublisherReturns(true);
@@ -333,7 +332,7 @@ public class RabbitBinderTests extends
ccf.resetConnection();
DirectChannel moduleOutputChannel = createBindableChannel("output",
new BindingProperties());
- ExtendedProducerProperties producerProps = createProducerProperties();
+ ExtendedProducerProperties producerProps = createProducerProperties(testInfo);
producerProps.setErrorChannelEnabled(true);
producerProps.getExtension().setConfirmAckChannel("acksChannel");
Binding producerBinding = binder.bindProducer("acks.0",
@@ -354,7 +353,7 @@ public class RabbitBinderTests extends
}
@Test
- public void testProducerConfirmHeader() throws Exception {
+ public void testProducerConfirmHeader(TestInfo testInfo) throws Exception {
RabbitTestBinder binder = getBinder();
CachingConnectionFactory ccf = this.rabbitAvailableRule.getResource();
ccf.setPublisherReturns(true);
@@ -362,7 +361,7 @@ public class RabbitBinderTests extends
ccf.resetConnection();
DirectChannel moduleOutputChannel = createBindableChannel("output",
new BindingProperties());
- ExtendedProducerProperties producerProps = createProducerProperties();
+ ExtendedProducerProperties producerProps = createProducerProperties(testInfo);
producerProps.getExtension().setUseConfirmHeader(true);
Binding producerBinding = binder.bindProducer("confirms.0",
moduleOutputChannel, producerProps);
@@ -791,11 +790,11 @@ public class RabbitBinderTests extends
}
@Test
- public void testProducerProperties() throws Exception {
+ public void testProducerProperties(TestInfo testInfo) throws Exception {
RabbitTestBinder binder = getBinder();
Binding producerBinding = binder.bindProducer("props.0",
createBindableChannel("input", new BindingProperties()),
- createProducerProperties());
+ createProducerProperties(testInfo));
Lifecycle endpoint = extractEndpoint(producerBinding);
MessageDeliveryMode mode = TestUtils.getPropertyValue(endpoint,
"defaultDeliveryMode", MessageDeliveryMode.class);
@@ -808,7 +807,7 @@ public class RabbitBinderTests extends
assertThat(TestUtils.getPropertyValue(endpoint, "amqpTemplate.transactional",
Boolean.class)).isFalse();
- ExtendedProducerProperties producerProperties = createProducerProperties();
+ ExtendedProducerProperties producerProperties = createProducerProperties(testInfo);
this.applicationContext.registerBean("pkExtractor",
TestPartitionKeyExtractorClass.class, () -> new TestPartitionKeyExtractorClass());
this.applicationContext.registerBean("pkSelector",
@@ -1090,7 +1089,7 @@ public class RabbitBinderTests extends
}
@Test
- public void testAutoBindDLQPartionedConsumerFirst() throws Exception {
+ public void testAutoBindDLQPartionedConsumerFirst(TestInfo testInfo) throws Exception {
RabbitTestBinder binder = getBinder();
ExtendedConsumerProperties properties = createConsumerProperties();
properties.getExtension().setPrefix("bindertest.");
@@ -1114,7 +1113,7 @@ public class RabbitBinderTests extends
Binding defaultConsumerBinding2 = binder.bindConsumer("partDLQ.0",
"default", new QueueChannel(), properties);
- ExtendedProducerProperties producerProperties = createProducerProperties();
+ ExtendedProducerProperties producerProperties = createProducerProperties(testInfo);
producerProperties.getExtension().setPrefix("bindertest.");
this.applicationContext.registerBean("pkExtractor", PartitionTestSupport.class, () -> new PartitionTestSupport());
this.applicationContext.registerBean("pkSelector", PartitionTestSupport.class, () -> new PartitionTestSupport());
@@ -1192,19 +1191,19 @@ public class RabbitBinderTests extends
}
@Test
- public void testAutoBindDLQPartitionedConsumerFirstWithRepublishNoRetry()
+ public void testAutoBindDLQPartitionedConsumerFirstWithRepublishNoRetry(TestInfo testInfo)
throws Exception {
- testAutoBindDLQPartionedConsumerFirstWithRepublishGuts(false);
+ testAutoBindDLQPartionedConsumerFirstWithRepublishGuts(false, testInfo);
}
@Test
- public void testAutoBindDLQPartitionedConsumerFirstWithRepublishWithRetry()
+ public void testAutoBindDLQPartitionedConsumerFirstWithRepublishWithRetry(TestInfo testInfo)
throws Exception {
- testAutoBindDLQPartionedConsumerFirstWithRepublishGuts(true);
+ testAutoBindDLQPartionedConsumerFirstWithRepublishGuts(true, testInfo);
}
private void testAutoBindDLQPartionedConsumerFirstWithRepublishGuts(
- final boolean withRetry) throws Exception {
+ final boolean withRetry, TestInfo testInfo) throws Exception {
RabbitTestBinder binder = getBinder();
ExtendedConsumerProperties properties = createConsumerProperties();
properties.getExtension().setPrefix("bindertest.");
@@ -1231,7 +1230,7 @@ public class RabbitBinderTests extends
Binding defaultConsumerBinding2 = binder
.bindConsumer("partPubDLQ.0", "default", new QueueChannel(), properties);
- ExtendedProducerProperties producerProperties = createProducerProperties();
+ ExtendedProducerProperties producerProperties = createProducerProperties(testInfo);
producerProperties.getExtension().setPrefix("bindertest.");
producerProperties.getExtension().setAutoBindDlq(true);
this.applicationContext.registerBean("pkExtractor", PartitionTestSupport.class, () -> new PartitionTestSupport());
@@ -1349,9 +1348,9 @@ public class RabbitBinderTests extends
}
@Test
- public void testAutoBindDLQPartitionedProducerFirst() throws Exception {
+ public void testAutoBindDLQPartitionedProducerFirst(TestInfo testInfo) throws Exception {
RabbitTestBinder binder = getBinder();
- ExtendedProducerProperties properties = createProducerProperties();
+ ExtendedProducerProperties properties = createProducerProperties(testInfo);
properties.getExtension().setPrefix("bindertest.");
properties.getExtension().setAutoBindDlq(true);
@@ -1664,9 +1663,9 @@ public class RabbitBinderTests extends
@SuppressWarnings("unchecked")
@Test
- public void testBatchingAndCompression() throws Exception {
+ public void testBatchingAndCompression(TestInfo testInfo) throws Exception {
RabbitTestBinder binder = getBinder();
- ExtendedProducerProperties producerProperties = createProducerProperties();
+ ExtendedProducerProperties producerProperties = createProducerProperties(testInfo);
producerProperties.getExtension()
.setDeliveryMode(MessageDeliveryMode.NON_PERSISTENT);
producerProperties.getExtension().setBatchingEnabled(true);
@@ -1726,9 +1725,9 @@ public class RabbitBinderTests extends
@SuppressWarnings("unchecked")
@Test
- public void testProducerBatching() throws Exception {
+ public void testProducerBatching(TestInfo testInfo) throws Exception {
RabbitTestBinder binder = getBinder();
- ExtendedProducerProperties producerProperties = createProducerProperties();
+ ExtendedProducerProperties producerProperties = createProducerProperties(testInfo);
producerProperties.getExtension()
.setDeliveryMode(MessageDeliveryMode.NON_PERSISTENT);
producerProperties.getExtension().setBatchingEnabled(true);
@@ -1768,9 +1767,9 @@ public class RabbitBinderTests extends
@SuppressWarnings("unchecked")
@Test
- public void testConsumerBatching() throws Exception {
+ public void testConsumerBatching(TestInfo testInfo) throws Exception {
RabbitTestBinder binder = getBinder();
- ExtendedProducerProperties producerProperties = createProducerProperties();
+ ExtendedProducerProperties producerProperties = createProducerProperties(testInfo);
producerProperties.getExtension()
.setDeliveryMode(MessageDeliveryMode.NON_PERSISTENT);
@@ -1806,9 +1805,9 @@ public class RabbitBinderTests extends
@SuppressWarnings("unchecked")
@Test
- public void testInternalHeadersNotPropagated() throws Exception {
+ public void testInternalHeadersNotPropagated(TestInfo testInfo) throws Exception {
RabbitTestBinder binder = getBinder();
- ExtendedProducerProperties producerProperties = createProducerProperties();
+ ExtendedProducerProperties producerProperties = createProducerProperties(testInfo);
producerProperties.getExtension()
.setDeliveryMode(MessageDeliveryMode.NON_PERSISTENT);
@@ -1848,7 +1847,7 @@ public class RabbitBinderTests extends
* queues.
*/
@Test
- public void testLateBinding() throws Exception {
+ public void testLateBinding(TestInfo testInfo) throws Exception {
RabbitTestSupport.RabbitProxy proxy = new RabbitTestSupport.RabbitProxy();
CachingConnectionFactory cf = new CachingConnectionFactory("localhost",
proxy.getPort());
@@ -1857,7 +1856,7 @@ public class RabbitBinderTests extends
new RabbitProperties(), new RabbitExchangeQueueProvisioner(cf));
RabbitTestBinder binder = new RabbitTestBinder(cf, rabbitBinder);
- ExtendedProducerProperties producerProperties = createProducerProperties();
+ ExtendedProducerProperties producerProperties = createProducerProperties(testInfo);
producerProperties.getExtension().setPrefix("latebinder.");
producerProperties.getExtension().setAutoBindDlq(true);
producerProperties.getExtension().setTransacted(true);
@@ -1897,7 +1896,7 @@ public class RabbitBinderTests extends
Binding partlate0Consumer1Binding = binder.bindConsumer(
"partlate.0", "test", partInputChannel1, partLateConsumerProperties);
- ExtendedProducerProperties noDlqProducerProperties = createProducerProperties();
+ ExtendedProducerProperties noDlqProducerProperties = createProducerProperties(testInfo);
noDlqProducerProperties.getExtension().setPrefix("latebinder.");
MessageChannel noDLQOutputChannel = createBindableChannel("output",
createProducerBindingProperties(noDlqProducerProperties));
@@ -2021,9 +2020,9 @@ public class RabbitBinderTests extends
}
@Test
- public void testRoutingKeyExpression() throws Exception {
+ public void testRoutingKeyExpression(TestInfo testInfo) throws Exception {
RabbitTestBinder binder = getBinder();
- ExtendedProducerProperties producerProperties = createProducerProperties();
+ ExtendedProducerProperties producerProperties = createProducerProperties(testInfo);
producerProperties.getExtension().setRoutingKeyExpression(
spelExpressionParser.parseExpression("payload.field"));
@@ -2064,9 +2063,9 @@ public class RabbitBinderTests extends
}
@Test
- public void testRoutingKeyExpressionPartitionedAndDelay() throws Exception {
+ public void testRoutingKeyExpressionPartitionedAndDelay(TestInfo testInfo) throws Exception {
RabbitTestBinder binder = getBinder();
- ExtendedProducerProperties producerProperties = createProducerProperties();
+ ExtendedProducerProperties producerProperties = createProducerProperties(testInfo);
producerProperties.getExtension().setRoutingKeyExpression(
spelExpressionParser.parseExpression("#root.getPayload().field"));
// requires delayed message exchange plugin; tested locally
@@ -2265,9 +2264,9 @@ public class RabbitBinderTests extends
}
@Test
- public void testCustomBatchingStrategy() throws Exception {
+ public void testCustomBatchingStrategy(TestInfo testInfo) throws Exception {
RabbitTestBinder binder = getBinder();
- ExtendedProducerProperties producerProperties = createProducerProperties();
+ ExtendedProducerProperties producerProperties = createProducerProperties(testInfo);
producerProperties.getExtension().setDeliveryMode(MessageDeliveryMode.NON_PERSISTENT);
producerProperties.getExtension().setBatchingEnabled(true);
producerProperties.getExtension().setBatchingStrategyBeanName("testCustomBatchingStrategy");
diff --git a/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/integration/RabbitBinderModuleTests.java b/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/integration/RabbitBinderModuleTests.java
index 715fabbb0..b82637ceb 100644
--- a/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/integration/RabbitBinderModuleTests.java
+++ b/spring-cloud-stream-binder-rabbit/src/test/java/org/springframework/cloud/stream/binder/rabbit/integration/RabbitBinderModuleTests.java
@@ -27,9 +27,9 @@ import com.rabbitmq.http.client.Client;
import com.rabbitmq.http.client.domain.BindingInfo;
import com.rabbitmq.http.client.domain.ExchangeInfo;
import com.rabbitmq.http.client.domain.QueueInfo;
-import org.junit.After;
-import org.junit.ClassRule;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
import org.mockito.Mockito;
import org.springframework.amqp.core.DeclarableCustomizer;
@@ -94,7 +94,7 @@ import static org.mockito.Mockito.verify;
*/
public class RabbitBinderModuleTests {
- @ClassRule
+ @RegisterExtension
public static RabbitTestSupport rabbitTestSupport = new RabbitTestSupport();
private ConfigurableApplicationContext context;
@@ -102,7 +102,7 @@ public class RabbitBinderModuleTests {
public static final ConnectionFactory MOCK_CONNECTION_FACTORY = mock(
ConnectionFactory.class, Mockito.RETURNS_MOCKS);
- @After
+ @AfterEach
public void tearDown() {
if (context != null) {
context.close();