From 8fd07b1a0c4f41fdb09f554ee6456692cfb37bfa Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Thu, 15 Apr 2021 10:29:26 -0400 Subject: [PATCH] Revert Spring deps to SNAPSHOTs * Optimize `InboundOneWayErrorTests` to not close ctx after each test. Probably will affect ActiveMQ connection to avoid a race condition when it is not started yet, but we produce a message --- build.gradle | 12 +++++----- .../jms/config/InboundOneWayErrorTests.java | 23 ++++++++++++------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index 5860ea9341..2463299fb2 100644 --- a/build.gradle +++ b/build.gradle @@ -97,13 +97,13 @@ ext { servletApiVersion = '4.0.1' smackVersion = '4.3.5' soapVersion = '1.4.0' - springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '2.3.6' - springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : '2021.0.0' - springKafkaVersion = '2.7.0' + springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '2.3.7-SNAPSHOT' + springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : '2021.0.1-SNAPSHOT' + springKafkaVersion = '2.7.1-SNAPSHOT' springRetryVersion = '1.3.1' - springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '5.5.0-RC1' - springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.3.6' - springWsVersion = '3.1.0-RC1' + springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '5.5.0-SNAPSHOT' + springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.3.7-SNAPSHOT' + springWsVersion = '3.1.0-SNAPSHOT' tomcatVersion = '9.0.45' xmlUnitVersion = '2.8.2' xstreamVersion = '1.4.16' diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/InboundOneWayErrorTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/InboundOneWayErrorTests.java index 7fbd22ca20..9c002714f3 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/InboundOneWayErrorTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/InboundOneWayErrorTests.java @@ -24,6 +24,7 @@ import java.util.concurrent.TimeUnit; import javax.jms.ConnectionFactory; import javax.jms.Destination; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -43,22 +44,29 @@ import org.springframework.util.ErrorHandler; * @author Artem Bilan */ @SpringJUnitConfig -@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) +@DirtiesContext public class InboundOneWayErrorTests extends ActiveMQMultiContextTests { @Autowired ApplicationContext context; + @Autowired + TestErrorHandler errorHandler; + + @BeforeEach + void setup() { + this.errorHandler.lastError = null; + } + @Test public void noErrorChannel() throws Exception { JmsTemplate jmsTemplate = new JmsTemplate(context.getBean("jmsConnectionFactory", ConnectionFactory.class)); Destination queue = context.getBean("queueA", Destination.class); jmsTemplate.send(queue, session -> session.createTextMessage("test-A")); - TestErrorHandler errorHandler = context.getBean("testErrorHandler", TestErrorHandler.class); - errorHandler.latch.await(3000, TimeUnit.MILLISECONDS); - assertThat(errorHandler.lastError).isNotNull(); - assertThat(errorHandler.lastError.getCause()).isNotNull(); - assertThat(errorHandler.lastError.getCause().getMessage()).isEqualTo("failed to process: test-A"); + assertThat(this.errorHandler.latch.await(3000, TimeUnit.MILLISECONDS)).isTrue(); + assertThat(this.errorHandler.lastError).isNotNull(); + assertThat(this.errorHandler.lastError.getCause()).isNotNull(); + assertThat(this.errorHandler.lastError.getCause().getMessage()).isEqualTo("failed to process: test-A"); PollableChannel testErrorChannel = context.getBean("testErrorChannel", PollableChannel.class); assertThat(testErrorChannel.receive(0)).isNull(); } @@ -76,8 +84,7 @@ public class InboundOneWayErrorTests extends ActiveMQMultiContextTests { assertThat(exception.getCause()).isNotNull(); assertThat(exception.getCause().getClass()).isEqualTo(TestException.class); assertThat(exception.getCause().getMessage()).isEqualTo("failed to process: test-B"); - TestErrorHandler errorHandler = context.getBean("testErrorHandler", TestErrorHandler.class); - assertThat(errorHandler.lastError).isNull(); + assertThat(this.errorHandler.lastError).isNull(); }