Fixes according latest upgrades

* Add `--add-opens` to `asciidoctor` Gradle task to avoid compilation warning
* Upgrade to Kotlin `1.6.10` and modify its Gradle task respective
* Add empty impl for new `AnnotationMetadataAdapter.getDeclaredMethods()`
* Parse HTTP methods to new `String methodNames` property of the `RequestMapping`
since `HttpMethod` is not an `enum` anymore.
* Ignore JDBC tests which rely on a map property resolution: the `[]` placeholder
is not handled in the latest SF anymore.
* Fix `WebFluxInboundEndpoint` for deprecations
This commit is contained in:
Artem Bilan
2022-01-06 17:24:11 -05:00
parent a80b22638d
commit b3ae24eac6
17 changed files with 205 additions and 163 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 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.
@@ -239,7 +239,7 @@ public class HttpInboundEndpointParser extends AbstractSingleBeanDefinitionParse
String methods = element.getAttribute("supported-methods");
if (StringUtils.hasText(methods)) {
requestMappingDefBuilder.addPropertyValue("methods", methods.toUpperCase());
requestMappingDefBuilder.addPropertyValue("methodNames", methods.toUpperCase());
}
IntegrationNamespaceUtils.setValueIfAttributeDefined(requestMappingDefBuilder, element, "path", "pathPatterns");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2021 the original author or authors.
* Copyright 2016-2022 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.
@@ -18,12 +18,14 @@ package org.springframework.integration.http.config;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import org.w3c.dom.Element;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.xml.BeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.core.type.MethodMetadata;
import org.springframework.integration.config.annotation.AnnotationMetadataAdapter;
/**
@@ -48,6 +50,11 @@ public class IntegrationGraphControllerParser implements BeanDefinitionParser {
return Collections.singletonMap("value", element.getAttribute("path"));
}
@Override
public Set<MethodMetadata> getDeclaredMethods() {
return null;
}
}, parserContext.getRegistry());
return null;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2019 the original author or authors.
* Copyright 2013-2022 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.
@@ -67,6 +67,16 @@ public class RequestMapping {
return this.pathPatterns; // NOSONAR - expose internals
}
/**
* Configure a set of supported HTTP methods from their string representations.
* @param supportedMethods the array of HTTP method names.
* @since 6.0
*/
public void setMethodNames(String... supportedMethods) {
Assert.notEmpty(supportedMethods, "at least one supported methods is required");
setMethods(Arrays.stream(supportedMethods).map(HttpMethod::valueOf).toArray(HttpMethod[]::new));
}
public void setMethods(HttpMethod... supportedMethods) {
Assert.notEmpty(supportedMethods, "at least one supported methods is required");
this.methods = Arrays.copyOf(supportedMethods, supportedMethods.length);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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,6 @@
package org.springframework.integration.http.support;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -56,17 +55,6 @@ import org.springframework.messaging.MessageHeaders;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class DefaultHttpHeaderMapperFromMessageInboundTests {
@Test
public void validateAllowWithWrongMethodName() {
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();
Map<String, Object> messageHeaders = new HashMap<>();
messageHeaders.put("Allow", "bar");
HttpHeaders headers = new HttpHeaders();
assertThatIllegalArgumentException()
.isThrownBy(() -> mapper.fromHeaders(new MessageHeaders(messageHeaders), headers));
}
@Test
public void validateAllowAsString() {
HeaderMapper<HttpHeaders> mapper = DefaultHttpHeaderMapper.inboundMapper();