Start 6.0 version

* Upgrade to Java 17, SF-6.0, Gradle 7.2
* Upgrade to Jakarta dependencies and respective namespaces
* Fix some tests for Java 17 compatibility
* Fix wrong Javadocs
* Add some missed Javadocs
* Fix more `jakarta` namespace
* Fix WS & XML modules to use Jakarta EE
* `--add-opens` in some modules for their reflection-based tests
* Disable Kafka tests which does not work on Windows; see Apache Kafka `3.0.1`
* Upgrade to JUnit `5.8.1`
* Migrate JMS tests to Artemis
* Remove RMI module as it was deprecated before
* Fix `pr-build-workflow.yml` for Java 17
* Fix JavaDocs warnings using `Xdoclint:syntax` per module, not in the top-level `api` task
* Move docs for version `6.0`
This commit is contained in:
Artem Bilan
2021-11-03 09:38:10 -04:00
parent 4423e43cd8
commit a80b22638d
225 changed files with 2196 additions and 2628 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2021 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.
@@ -20,8 +20,8 @@ import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.HashMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.expression.Expression;
import org.springframework.expression.common.LiteralExpression;

View File

@@ -22,10 +22,11 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.xml.transform.Source;
import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.core.ResolvableType;
@@ -386,8 +387,7 @@ public abstract class HttpRequestHandlingEndpointSupport extends BaseHttpInbound
for (Cookie requestCookie : requestCookies) {
cookies.add(requestCookie.getName(), requestCookie);
}
// TODO no toSingleValueMap() in the next major version
evaluationContext.setVariable("cookies", cookies.toSingleValueMap());
evaluationContext.setVariable("cookies", cookies);
}
Map<?, ?> pathVariables =

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2021 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.
@@ -20,8 +20,8 @@ import java.io.IOException;
import java.util.Collections;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2020 the original author or authors.
* Copyright 2013-2021 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.
@@ -23,8 +23,8 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor;

View File

@@ -28,7 +28,7 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletResponse;
import org.junit.jupiter.api.Test;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2021 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.
@@ -25,10 +25,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletResponse;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.annotation.Autowired;
@@ -51,8 +50,7 @@ import org.springframework.messaging.SubscribableChannel;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
/**
* @author Mark Fisher
@@ -63,8 +61,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* @author Biju Kunjummen
* @author Artem Bilan
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@SpringJUnitConfig
@DirtiesContext
public class HttpInboundGatewayParserTests {

View File

@@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import javax.servlet.http.Cookie;
import jakarta.servlet.http.Cookie;
import org.apache.commons.logging.LogFactory;
import org.junit.jupiter.api.Test;
@@ -330,7 +330,7 @@ public class HttpRequestHandlingControllerTests extends AbstractHttpInboundTests
protected Object handleRequestMessage(Message<?> requestMessage) {
try {
latch2.countDown();
// hold up an active thread so we can verify the count and that it completes ok
// hold up an active thread, so we can verify the count and that it completes ok
latch1.await(10, TimeUnit.SECONDS);
}
catch (InterruptedException e) {
@@ -407,7 +407,7 @@ public class HttpRequestHandlingControllerTests extends AbstractHttpInboundTests
controller.setViewName("foo");
controller.setReplyKey("cookiesReply");
controller.setExtractReplyPayload(true);
controller.setPayloadExpression(new SpelExpressionParser().parseExpression("#cookies['c1']?.value"));
controller.setPayloadExpression(new SpelExpressionParser().parseExpression("#cookies['c1'][0].value"));
controller.setBeanFactory(mock(BeanFactory.class));
controller.afterPropertiesSet();
controller.start();

View File

@@ -29,7 +29,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import org.junit.jupiter.api.Test;

View File

@@ -17,12 +17,13 @@
package org.springframework.integration.http.inbound;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.Cookie;
import jakarta.servlet.http.Cookie;
import org.junit.jupiter.api.Test;
@@ -48,9 +49,9 @@ import org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter;
/**
* @author Artem Bilan
* @author Gary Russell
*
* @since 3.0
*/
//INT-2312
@SpringJUnitConfig
@DirtiesContext
public class Int2312RequestMappingIntegrationTests extends AbstractHttpInboundTests {
@@ -129,9 +130,9 @@ public class Int2312RequestMappingIntegrationTests extends AbstractHttpInboundTe
assertThat(requestParams).isNotNull();
assertThat(((HttpHeaders) requestHeaders).getContentType()).isEqualTo(MediaType.TEXT_PLAIN);
Map<String, Cookie> cookies = (Map<String, Cookie>) headers.get("cookies");
MultiValueMap<String, Cookie> cookies = (MultiValueMap<String, Cookie>) headers.get("cookies");
assertThat(cookies.size()).isEqualTo(1);
Cookie foo = cookies.get("foo");
Cookie foo = cookies.getFirst("foo");
assertThat(foo).isNotNull();
assertThat(foo).isEqualTo(cookie);
});
@@ -148,22 +149,16 @@ public class Int2312RequestMappingIntegrationTests extends AbstractHttpInboundTe
@Test
public void testParams() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/params");
Object handler = null;
try {
handler = this.handlerMapping.getHandler(request);
}
catch (Exception e) {
// There is no matching handlers and some default handler
//See org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping#handleNoMatch
assertThat(e instanceof UnsatisfiedServletRequestParameterException).isTrue();
}
// There is no matching handlers and some default handler
//See org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping#handleNoMatch
assertThatExceptionOfType(UnsatisfiedServletRequestParameterException.class)
.isThrownBy(() -> this.handlerMapping.getHandler(new MockHttpServletRequest("GET", "/params")));
request = new MockHttpServletRequest("GET", "/params");
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/params");
request.addParameter("param1", "1");
request.addParameter("param2", "1");
handler = this.handlerMapping.getHandler(request).getHandler();
Object handler = this.handlerMapping.getHandler(request).getHandler();
MockHttpServletResponse response = new MockHttpServletResponse();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2019 the original author or authors.
* Copyright 2015-2021 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.
@@ -25,17 +25,16 @@ import static org.mockito.Mockito.when;
import java.util.Collections;
import java.util.Enumeration;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletInputStream;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.messaging.Message;
import org.springframework.web.context.request.RequestAttributes;
@@ -53,8 +52,7 @@ public class MultipartAsRawByteArrayTests {
@Test
public void testMultiPass() throws Exception {
HttpRequestHandlingMessagingGateway gw = new HttpRequestHandlingMessagingGateway(false);
gw.setMessageConverters(
Collections.<HttpMessageConverter<?>>singletonList(new ByteArrayHttpMessageConverter()));
gw.setMessageConverters(Collections.singletonList(new ByteArrayHttpMessageConverter()));
gw.setMergeWithDefaultConverters(false);
QueueChannel requestChannel = new QueueChannel();
gw.setRequestChannel(requestChannel);
@@ -70,7 +68,7 @@ public class MultipartAsRawByteArrayTests {
int done;
@Override
public Integer answer(InvocationOnMock invocation) throws Throwable {
public Integer answer(InvocationOnMock invocation) {
byte[] buff = invocation.getArgument(0);
buff[0] = 'f';
buff[1] = 'o';