From 8f92bb26d3fc5fabcfbd43b0c5f99aab16d0b3da Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Fri, 1 May 2020 14:05:26 -0400 Subject: [PATCH] Start version 5.4 * Fix compatibility after upgrading to some latest dependencies --- build.gradle | 14 ++--- gradle.properties | 2 +- .../config/GroovyServiceActivatorTests.java | 59 ++++++++----------- .../client/StompIntegrationTests.java | 12 ++-- 4 files changed, 39 insertions(+), 48 deletions(-) diff --git a/build.gradle b/build.gradle index 47b8ef52b9..a3b3df6d35 100644 --- a/build.gradle +++ b/build.gradle @@ -59,9 +59,9 @@ ext { derbyVersion = '10.14.2.0' ftpServerVersion = '1.1.1' googleJsr305Version = '3.0.2' - groovyVersion = '2.5.11' + groovyVersion = '3.0.3' hamcrestVersion = '2.2' - hazelcastVersion = '3.12.6' + hazelcastVersion = '4.0.1' hibernateVersion = '5.4.14.Final' hsqldbVersion = '2.5.0' h2Version = '1.4.200' @@ -92,11 +92,11 @@ ext { rsocketVersion = '1.0.0' servletApiVersion = '4.0.1' smackVersion = '4.3.4' - springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '2.2.6.RELEASE' - springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : 'Neumann-RELEASE' - springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '5.3.2.RELEASE' + springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '2.3.0.BUILD-SNAPSHOT' + springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : 'Neumann-BUILD-SNAPSHOT' + springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '5.4.0.BUILD-SNAPSHOT' springRetryVersion = '1.2.5.RELEASE' - springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.2.6.RELEASE' + springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.3.0-SNAPSHOT' springWsVersion = '3.0.9.RELEASE' tomcatVersion = "9.0.35" xstreamVersion = '1.4.12' @@ -112,7 +112,7 @@ allprojects { if (project.hasProperty('mavenLocal')) { mavenLocal() } - if (version.endsWith('BUILD-SNAPSHOT')) { + if (version.endsWith('SNAPSHOT')) { maven { url 'https://repo.spring.io/libs-snapshot' } } maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } diff --git a/gradle.properties b/gradle.properties index 9a3aafd185..a403ead0e6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=5.3.1.BUILD-SNAPSHOT +version=5.4.0-SNAPSHOT org.gradle.jvmargs=-Xmx1536m -Dfile.encoding=UTF-8 org.gradle.caching=true org.gradle.parallel=true diff --git a/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/config/GroovyServiceActivatorTests.java b/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/config/GroovyServiceActivatorTests.java index 60278df2ec..3b92254311 100644 --- a/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/config/GroovyServiceActivatorTests.java +++ b/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/config/GroovyServiceActivatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -17,7 +17,7 @@ package org.springframework.integration.groovy.config; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -26,8 +26,7 @@ import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.parsing.BeanDefinitionParsingException; @@ -43,8 +42,7 @@ import org.springframework.messaging.PollableChannel; import org.springframework.messaging.support.ErrorMessage; import org.springframework.messaging.support.GenericMessage; import org.springframework.scripting.groovy.GroovyObjectCustomizer; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import groovy.lang.GroovyObject; import groovy.lang.MissingPropertyException; @@ -54,10 +52,10 @@ import groovy.lang.MissingPropertyException; * @author Oleg Zhurakousky * @author Artem Bilan * @author Gunnar Hillert + * * @since 2.0 */ -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@SpringJUnitConfig public class GroovyServiceActivatorTests { @Autowired @@ -86,7 +84,7 @@ public class GroovyServiceActivatorTests { @Test - public void referencedScriptAndCustomiser() throws Exception { + public void referencedScriptAndCustomizer() throws Exception { groovyCustomizer.executed = false; QueueChannel replyChannel = new QueueChannel(); replyChannel.setBeanName("returnAddress"); @@ -134,7 +132,7 @@ public class GroovyServiceActivatorTests { } @Test - public void inlineScript() throws Exception { + public void inlineScript() { groovyCustomizer.executed = false; QueueChannel replyChannel = new QueueChannel(); replyChannel.setBeanName("returnAddress"); @@ -156,7 +154,7 @@ public class GroovyServiceActivatorTests { } @Test - public void testScriptWithoutVariables() throws Exception { + public void testScriptWithoutVariables() { PollableChannel replyChannel = new QueueChannel(); for (int i = 1; i <= 3; i++) { Message message = MessageBuilder.withPayload("test-" + i).setReplyChannel(replyChannel).build(); @@ -174,33 +172,28 @@ public class GroovyServiceActivatorTests { assertThat(replyChannel.receive(0)).isNull(); } - //INT-2399 - @Test(expected = MessageHandlingException.class) - public void invalidInlineScript() throws Exception { - Message message = - new ErrorMessage(new ReplyRequiredException(new GenericMessage("test"), "reply required!")); - try { - this.invalidInlineScript.send(message); - fail("MessageHandlingException expected!"); - } - catch (Exception e) { - Throwable cause = e.getCause(); - assertThat(cause.getClass()).isEqualTo(MissingPropertyException.class); - assertThat(cause.getMessage()).contains("No such property: ReplyRequiredException for class: script"); - throw e; - } - + @Test + public void invalidInlineScript() { + assertThatExceptionOfType(MessageHandlingException.class) + .isThrownBy(() -> + this.invalidInlineScript.send( + new ErrorMessage( + new ReplyRequiredException(new GenericMessage<>("test"), "reply required!")))) + .withStackTraceContaining("No such property: ReplyRequiredException for class: Script_") + .withCauseInstanceOf(MissingPropertyException.class); } - @Test(expected = BeanDefinitionParsingException.class) - public void variablesAndScriptVariableGenerator() throws Exception { - new ClassPathXmlApplicationContext("GroovyServiceActivatorTests-fail-withgenerator-context.xml", - this.getClass()).close(); + @Test + public void variablesAndScriptVariableGenerator() { + assertThatExceptionOfType(BeanDefinitionParsingException.class) + .isThrownBy(() -> + new ClassPathXmlApplicationContext("GroovyServiceActivatorTests-fail-withgenerator-context.xml", + this.getClass())); } @Test public void testGroovyScriptForOutboundChannelAdapter() { - this.outboundChannelAdapterWithGroovy.send(new GenericMessage("foo")); + this.outboundChannelAdapterWithGroovy.send(new GenericMessage<>("foo")); assertThat(this.invoked.get()).isTrue(); } @@ -208,7 +201,7 @@ public class GroovyServiceActivatorTests { public static class SampleScriptVariSource implements ScriptVariableGenerator { public Map generateScriptVariables(Message message) { - Map variables = new HashMap(); + Map variables = new HashMap<>(); variables.put("foo", "foo"); variables.put("bar", "bar"); variables.put("date", new Date()); diff --git a/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/client/StompIntegrationTests.java b/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/client/StompIntegrationTests.java index 818562b535..302c86d2a8 100644 --- a/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/client/StompIntegrationTests.java +++ b/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/client/StompIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-2020 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. @@ -27,8 +27,7 @@ import java.util.Collections; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -80,7 +79,7 @@ import org.springframework.messaging.support.MessageBuilder; import org.springframework.stereotype.Controller; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.MultiValueMap; import org.springframework.web.socket.client.WebSocketClient; import org.springframework.web.socket.client.standard.StandardWebSocketClient; @@ -104,7 +103,7 @@ import org.springframework.web.socket.sockjs.client.WebSocketTransport; * @since 4.1 */ @ContextConfiguration(classes = StompIntegrationTests.ClientConfig.class) -@RunWith(SpringRunner.class) +@SpringJUnitConfig @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) public class StompIntegrationTests { @@ -382,7 +381,6 @@ public class StompIntegrationTests { } @Bean - @SuppressWarnings("unchecked") public ApplicationListener webSocketEventListener() { ApplicationEventListeningMessageProducer producer = new ApplicationEventListeningMessageProducer(); producer.setEventTypes(AbstractSubProtocolEvent.class); @@ -446,7 +444,7 @@ public class StompIntegrationTests { @MessagingGateway @Controller - interface WebSocketGateway { + public interface WebSocketGateway { @MessageMapping("/greeting") @SendToUser("/queue/answer")