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
This commit is contained in:
Artem Bilan
2021-04-15 10:29:26 -04:00
parent d1155297b6
commit 8fd07b1a0c
2 changed files with 21 additions and 14 deletions

View File

@@ -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'

View File

@@ -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();
}